Can I select distinct value using findAll()
function?
I'm trying :
$province = $em->getRepository("FrontendBundle:Store")->findAll(array('distinct' => true));
But it doesn't seems to work.
The findall don't support this behaviour, in order to make a query on-the-fly (better in a separate repository class) you can do as follow:
/** @var $qb \Doctrine\ORM\QueryBuilder*/
$qb = $em->getRepository("GerlaFrontendBundle:Store")->createQueryBuilder("p");
$province = $qb->select("p")
->distinct(true)
->getQuery()
->getResult();
Hope this help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With