public function save($deep = true) { if (!$this->Demonstrated) { $this->Demonstrated = time(); } return parent::save($deep); }
public function save($deep = true) { // set handle if (!$this->Handle) { $this->Handle = HandleBehavior::generateRandomHandle(__CLASS__, 12); } parent::save(); }
public function save($deep = true) { // call parent parent::save($deep); if ($this->isFieldDirty('Content')) { Cache::delete($this->getHtmlCacheKey()); } }
public function save() { // set handle if (!$this->Handle) { $this->Handle = static::getUniqueHandle($this->Title); } // call parent parent::save(); }
public function save($deep = true) { // set author if (!$this->AuthorID && !empty($_SESSION) && !empty($_SESSION['User'])) { $this->Author = $_SESSION['User']; } // call parent parent::save($deep); }
public function save($deep = true) { HandleBehavior::onSave($this); if (!$this->Maintainer) { $this->Maintainer = $GLOBALS['Session']->Person; } parent::save($deep); if (!$this->Members) { ProjectMember::create(['ProjectID' => $this->ID, 'MemberID' => $this->Maintainer->ID, 'Role' => 'Founder'], true); } }
public function save($deep = true) { // set author if (!$this->AuthorID) { $this->Author = $_SESSION['User']; } // set published if (!$this->Published && $this->Status == 'Published') { $this->Published = time(); } // implement handles GlobalHandleBehavior::onSave($this, $this->Title); // call parent parent::save($deep); }
public function save($deep = true) { $wasCompetencyDirty = $this->isFieldDirty('CompetencyID'); $wasDemonstrationsRequiredDirty = $this->isFieldDirty('DemonstrationsRequired'); parent::save($deep); if ($wasCompetencyDirty) { if ($this->Competency) { $this->Competency->getSkillIds(true); // true to force refresh of cached value } if ($oldCompetencyId = $this->getOriginalValue('CompetencyID')) { Competency::getByID($oldCompetencyId)->getSkillIds(true); // true to force refresh of cached value } } if ($wasDemonstrationsRequiredDirty) { $this->Competency->getTotalDemonstrationsRequired(true); // true to force refresh of cached value } }