Esempio n. 1
0
 /**
  * Заполняет текущий объект строкой из базы данных.
  *
  * @param $article_row array строка из базы данных с создаваемой статьёй
  * @return Model_Article модель, заполненная полями из статьи, либо пустая модель, если была передана пустая строка.
  */
 private function fillByRow($article_row)
 {
     if (!empty($article_row['id'])) {
         $this->id = $article_row['id'];
         $this->title = $article_row['title'];
         $this->text = $article_row['text'];
         $this->description = $article_row['description'];
         $this->cover = $article_row['cover'];
         $this->user_id = $article_row['user_id'];
         $this->dt_create = $article_row['dt_create'];
         $this->dt_update = $article_row['dt_update'];
         $this->is_removed = $article_row['is_removed'];
         $this->is_published = $article_row['is_published'];
         $this->author = Model_User::get($this->user_id);
         $this->commentsCount = Model_Comment::countCommentsByArticle($this->id);
     }
     return $this;
 }