/**
  * {@inheritdoc}
  */
 public function buildByChannelAndCompleteness(ChannelInterface $channel)
 {
     $qb = $this->createQueryBuilder('p');
     foreach ($channel->getLocales() as $locale) {
         $qb->addOr($qb->expr()->field(sprintf('normalizedData.completenesses.%s-%s', $channel->getCode(), $locale->getCode()))->equals(100));
     }
     $categoryIds = $this->categoryRepository->getAllChildrenIds($channel->getCategory());
     $qb->addAnd($qb->expr()->field('categoryIds')->in($categoryIds));
     return $qb;
 }
 /**
  * Get children category ids
  *
  * @param integer[] $categoryIds
  *
  * @return integer[]
  */
 protected function getAllChildrenIds(array $categoryIds)
 {
     $allChildrenIds = [];
     foreach ($categoryIds as $categoryId) {
         $category = $this->categoryRepository->find($categoryId);
         $childrenIds = $this->categoryRepository->getAllChildrenIds($category);
         $childrenIds[] = $category->getId();
         $allChildrenIds = array_merge($allChildrenIds, $childrenIds);
     }
     return $allChildrenIds;
 }
 /**
  * Get children category ids
  *
  * @param CategoryInterface $category
  *
  * @return integer[]
  */
 protected function getAllChildrenIds(CategoryInterface $category)
 {
     $categoryIds = $this->categoryRepo->getAllChildrenIds($category);
     return $categoryIds;
 }