public function execute()
 {
     $table = new PhamePost();
     $conn_r = $table->establishConnection('r');
     $where_clause = $this->buildWhereClause($conn_r);
     $order_clause = $this->buildOrderClause($conn_r);
     $limit_clause = $this->buildLimitClause($conn_r);
     $data = queryfx_all($conn_r, 'SELECT * FROM %T e %Q %Q %Q', $table->getTableName(), $where_clause, $order_clause, $limit_clause);
     $posts = $table->loadAllFromArray($data);
     return $posts;
 }
 protected function loadPage()
 {
     $table = new PhamePost();
     $conn_r = $table->establishConnection('r');
     $where_clause = $this->buildWhereClause($conn_r);
     $order_clause = $this->buildOrderClause($conn_r);
     $limit_clause = $this->buildLimitClause($conn_r);
     $data = queryfx_all($conn_r, 'SELECT * FROM %T p %Q %Q %Q', $table->getTableName(), $where_clause, $order_clause, $limit_clause);
     $posts = $table->loadAllFromArray($data);
     if ($posts) {
         // We require these to do visibility checks, so load them unconditionally.
         $blog_phids = mpull($posts, 'getBlogPHID');
         $blogs = id(new PhameBlogQuery())->setViewer($this->getViewer())->withPHIDs($blog_phids)->execute();
         $blogs = mpull($blogs, null, 'getPHID');
         foreach ($posts as $post) {
             if (isset($blogs[$post->getBlogPHID()])) {
                 $post->setBlog($blogs[$post->getBlogPHID()]);
             }
         }
     }
     return $posts;
 }