/** * Convert JSON data to array and unset default properties * @return bool */ public function beforeSave() { $data = $this->getData(); if ($this->element) { $default = $this->element->getProperties(); foreach ($data as $k => $prop) { if (array_key_exists($prop['name'], $default)) { if ($prop['value'] == $default[$prop['name']]) { unset($data[$k]); } } } } $this->setProperty('data', $data); return parent::beforeSave(); }
/** * Convert JSON data to array and unset default properties * @return bool */ public function beforeSave() { $this->object->setProperties($this->getData()); return parent::beforeSave(); }