Phosphorum\Controllers\ControllerBase::prepareQueries PHP Method

prepareQueries() protected method

This method prepares the queries to be executed in each list of posts The returned builders are used as base in the search, tagged list and index lists
protected prepareQueries ( boolean $joinReply = false ) : array
$joinReply boolean
return array
    protected function prepareQueries($joinReply = false)
    {
        /** @var \Phalcon\Mvc\Model\Query\BuilderInterface $itemBuilder */
        $itemBuilder = $this->modelsManager->createBuilder()->from(['p' => 'Phosphorum\\Models\\Posts'])->orderBy('p.sticked DESC, p.created_at DESC');
        if ($joinReply) {
            $itemBuilder->groupBy('p.id')->join('Phosphorum\\Models\\PostsReplies', 'r.posts_id = p.id', 'r');
        }
        $totalBuilder = clone $itemBuilder;
        $itemBuilder->columns(['p.*'])->limit(self::POSTS_IN_PAGE);
        $totalBuilder->columns('COUNT(*) AS count');
        return [$itemBuilder, $totalBuilder];
    }