Add new function for getting count of segments with more filters
[MAILPOET-3427]
This commit is contained in:
@@ -221,4 +221,14 @@ class SegmentsRepository extends Repository {
|
|||||||
->setMaxResults($limit)
|
->setMaxResults($limit)
|
||||||
->getResult();
|
->getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCountWithMultipleConditions(): int {
|
||||||
|
$qb = $this->entityManager->createQueryBuilder()
|
||||||
|
->select('COUNT(DISTINCT s.id)')
|
||||||
|
->from(SegmentEntity::class, 's')
|
||||||
|
->join('s.dynamicFilters', 'ds')
|
||||||
|
->groupBy('ds.segment')
|
||||||
|
->having('COUNT(ds.id) > 1');
|
||||||
|
return (int)$qb->getQuery()->getSingleScalarResult();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user