public static function create($conn = null, $class = null) { $q = new BlogPostQuery($conn); return $q->select('p.*, u.city_id as user_city') ->from('Post p, p.Owner u, p.AnnouncedEvent ae') ; } public function countComments() { return $this->addSelect('(SELECT count(*) FROM Comment pc WHERE pc.post_id = p.id) as nb_comments'); } public function countBookmarksOld() { return $this->addSelect('(SELECT count(*) FROM PostBookmark pb WHERE pb.post_id = p.id) as nb_bookmarks'); }