publicfunctionwithCategories(): self
{
$this->onPostFetch[] = function (QueryBuilder$qb, Iterator$iterator) {
$qb->select('partial client.{id}')->from(Client::class, 'client')
->leftJoin('client.categories', 'categories')->addSelect('categories')
->andWhere('client.id IN (:ids)')
->setParameter('ids', $this->getIds($iterator))
->getQuery()->getResult();
};
return$this;
}
publicfunctionhasCategories(array$ids): self
{
if (empty($ids)) {
thrownewLogicException(sprintf('parameter %s::$ids can not be empty', __CLASS__));
}
$this->filters[] = function (QueryBuilder$qb) use ($ids) {
$qb->andWhere('client.categorie IN (:catogeries)')
->setParameter('catogeries', $ids);
};
return$this;
}
protectedfunctiondoCreateQuery(QueryBuilder$queryBuilder): QueryBuilder
{
$queryBuilder->select('client')
->from(Client::class, 'client', 'client.id');
$this->processSelects($queryBuilder);
$this->processFilters($queryBuilder);
return$queryBuilder;
}Uh oh!
There was an error while loading. Please reload this page.
Latest commit
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|