/** * beforeSave callback * * @param array $options * @return boolean true on success */ public function beforeSave($options = array()) { if (!parent::beforeSave($options)) { return false; } $Event = new CakeEvent('AudioStorage.beforeSave', $this, array('record' => $this->data)); $this->getEventManager()->dispatch($Event); if ($Event->isStopped()) { return false; } return true; }
/** * beforeSave callback * * @param array $options * @return boolean true on success */ public function beforeSave($options = array()) { if (!parent::beforeSave($options)) { return false; } $this->data[$this->alias]['model'] = !empty($this->data[$this->alias]['model']) ? $this->data[$this->alias]['model'] : $this->alias; // (this should not be set here, the model should be the to the model relationship to the ImageStorage relationship) $Event = new CakeEvent('ImageStorage.beforeSave', $this, array('record' => $this->data)); $this->getEventManager()->dispatch($Event); if ($Event->isStopped()) { return false; } return true; }