public function getRubricsContent(array $ids, $loadAll = false) { if ($loadAll) { return $this->loadRubrics('*'); } else { $result = array(); /** @var QueryParamAssoc */ foreach (Query::assocParamsIn('id_rubric', $ids) as $param) { foreach ($this->loadRubrics('*', $param) as $rubricId => $rubric) { $result[$rubricId] = $rubric; } } return $result; } }
public function getPostsContent(array $ids, $loadAll = false) { //what $what[] = 'p.*'; $what[] = "(select count(1) from {$this->commentsTable} where b_deleted=0 and id_post=p.id_post) as comments_count"; if ($loadAll) { return $this->loadPosts($what); } else { $result = array(); /** @var QueryParamAssoc */ foreach (Query::assocParamsIn('id_post', $ids) as $param) { foreach ($this->loadPosts($what, $param) as $postId => $post) { $result[$postId] = $post; } } return $result; } }