public function save(array $properties, $key = null, array $options = array()) { if (!$key && empty($properties['uuid'])) { $properties['uuid'] = $this->generate_uuid(); } return parent::save($properties, $key, $options); }
/** * Before saving the record, we make sure that it is not its own parent. */ public function save(array $properties, $key = null, array $options = array()) { if ($key && isset($properties[Page::PARENTID]) && $key == $properties[Page::PARENTID]) { throw new Exception('A page connot be its own parent.'); } if (empty($properties[Page::SITEID])) { throw new Exception('site_id is empty.'); } unset(self::$blueprint_cache[$properties[Page::SITEID]]); return parent::save($properties, $key, $options); }