Example #1
0
 public function get($post_id)
 {
     try {
         $sth = $this->db->prepare("SELECT *\n                                   FROM   " . TABLE_POSTS . "\n                                   WHERE  " . TB_POST_COL_ID . " = :post_id");
         $sth->execute(array(':post_id' => $post_id));
         $count = $sth->rowCount();
         if ($count != 1) {
             return null;
         }
         // fetch one row (we only have one result)
         $result = $sth->fetch();
         $this->autoloadBO('post');
         $postBO = new PostBO();
         $postBO->setPost($result);
         $postMetaInfoArray = $this->getMetaInfo($result->ID);
         $postBO->setPostMetaInfo($postMetaInfoArray);
         return $postBO;
     } catch (Exception $e) {
     }
     return null;
 }