$builder =
$this->
createQueryBuilder('c'
);
$builder->
select([ 'c.id as id',
'c.active as active',
'c.name as name',
'c.position as position',
'c.parentId as parentId',
'c.mediaId as mediaId',
]);
$builder =
$this->
addChildrenCountSelect($builder);
$builder =
$this->
addArticleCountSelect($builder);
if (!
empty($filterBy)) { $builder->
addFilter($filterBy);
} $builder->
addOrderBy('c.parentId'
);
$builder->
addOrderBy('c.position'
);
if (!
empty($orderBy)) { $builder->
addOrderBy($orderBy);
}