/** * @param bool $validate * @return bool */ public function save($validate = true) { if (parent::save($validate)) { return static::updatePermissionsList(); } return false; }
/** * @override * Save the model to the database. * * This function will automatically determine if an INSERT or UPDATE needs to occur. * If a validation or a callback for this model returns false, then the model will * not be saved and this will return false. * * If saving an existing model only data that has changed will be saved. * * @param boolean $validate Set to true or false depending on if you want the validators to run or not * @return boolean True if the model was saved to the database otherwise false */ public function save($validate = true) { if ($this->is_new_record()) { $dt = new \DateTime(); //var_dump($dt->getTimestamp()); $this->set_attributes(array($this->get_primary_key() => ZiUtil::GetTransID())); } //still use save parent return parent::save($validate); }
/** * Routes save operations to "master" connection then * switches back to the "slave" db connection. * * We add the $validate parameter because the parent * save method specifies its inclusion. */ public function save($validate = TRUE) { $slave_db = $this->switch_connection($this->master_db); parent::save($validate); $this->switch_connection($slave_db); }
/** * Save the model to the database * * Check for any validation errors and throw an exception if errors exist * * @see \ActiveRecord\Model::save() * @param boolean $validate Set to true or false depending on if you want the validators to run or not * @return boolean True if the model was saved to the database otherwise false */ public function save($validate = true) { $success = parent::save($validate); if (!$success) { throw ActiveRecordValidationException::createFromValidatedModel($this); } return $success; }