I have two entities, Carros
and Msg
, i am looking to get Carros
that have Msg
messages
$query = $entityManager->createQuery("
SELECT u
FROM Auto\Entity\Carros u
JOIN Auto\Entity\Msg m WITH m.idautoad=u.idcarros
WHERE u.identidade='".$emailidentidade."'
ORDER BY u.datadoanuncio DESC
");
I'm using the paginator:
// Create the paginator itself
$paginator = new Paginator(
new DoctrinePaginator(new ORMPaginator($query))
);
and i am getting the following errors i have zend 2.3.9 and doctrine 2.4
Arquivo: C:\websites\auto\vendor\zendframework\zendframework\library\Zend\Paginator\Paginator.php:637
Mensagem: Error producing an iterator
C:\websites\auto\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Pagination\WhereInWalker.php:85
Mensagem:
Cannot count query which selects two FROM components, cannot make distinction
its generating the error when i try to do this :
foreach ($paginator as $carro)
{}
The error disappears when getting the results like this :
$fi = $query->getResult();
and then
$paginator = new \Zend\Paginator\Paginator(new
\Zend\Paginator\Adapter\ArrayAdapter($fi)
);