コード例 #1
0
ファイル: AdminBean.php プロジェクト: ilivanoff/www
 public function getPostsWithUncheckedComments()
 {
     $beans = array(ISBean::inst(), BPBean::inst(), TRBean::inst());
     $result = array();
     /** @var PostsBean */
     foreach ($beans as $bean) {
         $table = $bean->getPostsTable();
         $table_comments = $bean->getCommentsTable();
         $query = "SELECT p.*, (SELECT count(*)\n             FROM {$table_comments} c\n            WHERE     c.id_post = p.id_post\n                  AND c.b_deleted = 0\n                  AND c.b_confirmed = 0\n                  AND c.id_user <> ?) as comments_count\n  FROM v_{$table} p\n WHERE EXISTS\n          (SELECT *\n             FROM {$table_comments} c\n            WHERE     c.id_post = p.id_post\n                  AND c.b_deleted = 0\n                  AND c.b_confirmed = 0\n                  AND c.id_user <> ?)";
         $posts = $this->getArray($query, array($this->adminId, $this->adminId));
         foreach ($posts as $postDataArr) {
             $result[$bean->getPostType()][] = new Post($bean->getPostType(), $postDataArr);
         }
     }
     return $result;
 }
コード例 #2
0
ファイル: MagManager.php プロジェクト: ilivanoff/www
 public function dbBean()
 {
     return ISBean::inst();
 }