/** * Returns a list of comments for a specific page * * @param SxCms_Page $page * @return array */ public function getCommentsByPage(SxCms_Page $page) { $id = (int) $page->getId(); $db = Zend_Registry::get('db'); $select = $db->select()->from('PageComment', array('*'))->where('page_id = ?', $id)->where('approved = 1')->order('datePosted DESC'); $stmt = $db->query($select); $result = $stmt->fetchAll(); $comments = array(); foreach ($result as $row) { $comment = $this->toObject($row); $comments[$comment->getId()] = $comment; } return $comments; }
public function addChild(SxCms_Page $page) { $this->children[$page->getId()] = $page; return $this; }