Add new function for getting count of segments with more filters

[MAILPOET-3427]
This commit is contained in:
Jan Lysý
2021-10-19 11:15:53 +02:00
committed by Veljko V
parent 02ad7c9c8e
commit 0af5f111be

View File

@@ -221,4 +221,14 @@ class SegmentsRepository extends Repository {
->setMaxResults($limit)
->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();
}
}