Exemplo n.º 1
0
 /**
  * This action shows all blog entries and the depending comment
  * 
  * @param View $view
  * @param array $parameters
  */
 public function actionShowAll(View $view, array $parameters)
 {
     $blogEntry = new BlogEntry($this->database);
     $blogEntries = $blogEntry->getAll();
     $view->setVar('blogEntries', $blogEntries);
     $commentEntry = new Comment($this->database);
     $comments = array();
     foreach ($blogEntries as $blogEntry) {
         $comments[$blogEntry->getId()] = $commentEntry->getAllByBlogEntry($blogEntry);
     }
     $view->setVar('comments', $comments);
     return $view;
 }
Exemplo n.º 2
0
 /**
  * Returns an array containing all CommentModels for a specific BlonEntry
  * 
  * @param BlogEntry $blogEntry
  * @return Comment[]
  */
 public function getAllByBlogEntry(BlogEntry $blogEntry)
 {
     return $this->select('SELECT * FROM comments WHERE blog_entry_id = ' . $blogEntry->getId() . ' ORDER BY id DESC');
 }