public function Insert() { if ($this->DateTime == null) { $this->DateTime = date('Y-m-d H:i:s'); } parent::Insert(); }
public function Update() { $this->Updated = date('Y-m-d H:i:s'); $TagTitles = ''; // for perfomance, we don't need lazy loading in this loop $this->PostsTags->LoadList('Tag'); foreach ($this->PostsTags as $PostsTags) { $TagTitles .= $PostsTags->Tag->Title; } $CommentText = ''; foreach ($this->Comments as $Comment) { $CommentText .= $Comment->Text; } $this->SearchHelper = $this->User->Name . $this->Text . $TagTitles . $CommentText; parent::Update(); }