/** * After-search callback. * * @return void * @since 0.1.0 */ public function afterFind() { parent::afterFind(); /** @var DataFormatter $formatter */ $formatter = \Yii::app()->formatter; $this->content = $formatter->renderMarkdown($this->content); $this->created = date('Y-m-d H:i:s', strtotime($this->created)); $this->timeAgo = $formatter->formatDateTime($this->created, 'timeAgo'); if (!empty($this->mail)) { $this->gravatar = 'http://www.gravatar.com/avatar/' . md5($this->mail); } else { $this->gravatar = 'http://www.gravatar.com/avatar/' . str_repeat('0', 32); } }
/** * Post Markdown-formatting callback. * * @return boolean Always returns true. * @since 0.1.0 */ public function afterFind() { parent::afterFind(); /** @var DataFormatter $formatter */ $formatter = \Yii::app()->formatter; $this->rendered = $formatter->renderMarkdown($this->content); return true; }