public function save() { if (!$this->CheckParams($this->modeltype)) { sendBack(); } if (!empty($this->_data['MFDowntimeCode']['id'])) { $mfdowntimecode = $this->_uses[$this->modeltype]; $mfdowntimecode->load($this->_data['MFDowntimeCode']['id']); if ($mfdowntimecode->isLoaded()) { foreach ($mfdowntimecode->mf_centres as $mfcentredowntimecode) { $mfcentredowntimecode->delete(); } } } if (isset($this->_data['MFCentreDowntimeCode'])) { $mfcentredowntimecode = DataObjectCollection::joinarray($this->_data['MFCentreDowntimeCode']); unset($this->_data['MFCentreDowntimeCode']); foreach ($mfcentredowntimecode as $key => $data) { $this->_data[$key]['MFCentreDowntimeCode'] = $data; } } parent::save(); }