public function getProductAmountPerCategory($categoryId, ?DateTimeInterface
$from = null, ?DateTimeInterface
$to = null
) { $builder =
$this->
createProductAmountBuilder($from,
$to) ->
addSelect('categories.description as name'
) ->
addSelect('( SELECT parent FROM s_categories WHERE categories.id = parent LIMIT 1 ) as node'
) ->
innerJoin('articles', 's_articles_categories_ro', 'articleCategories', 'articles.id = articleCategories.articleID'
) ->
innerJoin('articleCategories', 's_categories', 'categories', 'articleCategories.categoryID = categories.id'
) ->
andWhere('categories.active = 1'
) ->
groupBy('categories.id'
);
if ($categoryId) { $builder->
andWhere('categories.parent = :parent'
) ->
setParameter('parent',
$categoryId);
}