非常に長い話です$this->models[$modelKey]
が、最初のforeachで設定を解除しようとすると、設定解除は$this->models[$modelKey]->equipmentList->equipment[$eqKey]
正常に機能し、正しいオブジェクトを指しますが、ネストされたforeachで設定を解除しても機能しません。何か案は?助けてくれてありがとう。
public function processModelsEquipmentList() {
foreach ($this->models as $modelKey => $model) {
if (!strstr('#', $model->id)) {
foreach ($model->equipmentList->equipment as $eqKey => $equipment) {
if (in_array($equipment->code, $this->specialVersionsCodes)) {
$newModel = clone $model;
$newModel->name.= ' ' . $equipment->name;
$newModel->id.= '#' . $equipment->id;
if (strlen($newModel->code) < 4) {
$newModel->code.=$equipment->code;
}
$newModel->order = $newModel->order + 1;
$newEquipmentList = new EquipmentList($newModel->id, true);
$newEquipmentList->add(clone $equipment);
$newModel->setNewEquipmentList($newEquipmentList);
$this->addModel($newModel);
//echo $this->models[$modelKey]->equipmentList->equipment[$eqKey]->name;die();
unset($this->models[$modelKey]->equipmentList->equipment[$eqKey]);
}
}
}
}
}