/** * Save the model to the database * * Process any queued Redis commands to save in Redis * if the model saving was a success * * @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) { // The save worked, so let's also save to redis. $this->redis->process_queue(); } return $success; }
/** * Check if a given model is equal to this model * by checking if they refer to the same AR model * and by checking if their attributes are equivalent * * @param AbstractModel $model * @access public * @return boolean */ public function isEqual(AbstractModel $model) { // Check loose equality, since the attributes may // contain objects instantiated at different times if ($this->attributes() == $model->attributes() && $this->isSameModel($model)) { return true; } return false; }