public function beforeInsert() { if (!$this->isEmpty('name') && ($tag = $this->findByName($this->get('name')))) { $this->set('id', $tag->id); return false; } return parent::beforeInsert(); }
/** * */ public function beforeInsert() { // add confirmation code if field exists if ($this->hasField('confirmation_code')) { $this->set('confirmation_code', md5(time() . SALT)); } $this->passwordUnmasked = $this->password; $this->password = $this->maskPassword($this->password); return parent::beforeInsert(); }