Esempio n. 1
0
File: image.php Progetto: anqh/anqh
 /**
  * Get image comments
  *
  * @param   Model_User  $viewer
  * @return  Database_Result
  */
 public function comments(Model_User $viewer = null)
 {
     $query = Model_Comment::query_viewer(DB::select_array(Model_Image_Comment::factory()->fields())->order_by('id', 'DESC'), $viewer);
     return $this->find_related('image_comments', $query);
 }
Esempio n. 2
0
File: entry.php Progetto: anqh/blog
 /**
  * Get blog comments
  *
  * @param   Model_User  $viewer
  * @return  Database_Result
  */
 public function comments(Model_User $viewer = null)
 {
     $query = Model_Comment::query_viewer(DB::select_array(Model_Blog_Comment::factory()->fields()), $viewer);
     return $this->find_related('blog_comments', $query);
 }
Esempio n. 3
0
File: user.php Progetto: anqh/anqh
 /**
  * Get image comments
  *
  * @param   Model_User  $viewer
  * @param   View_Generic_Pagination  $pagination
  * @return  Model_User_Comment[]
  */
 public function comments(Model_User $viewer = null, View_Generic_Pagination $pagination = null)
 {
     $query = Model_Comment::query_viewer(DB::select_array(Model_User_Comment::factory()->fields()), $viewer)->order_by('id', 'DESC');
     if ($pagination) {
         $query = $query->offset($pagination->offset)->limit($pagination->items_per_page);
     }
     return $this->find_related('user_comments', $query);
 }