I have some some tables which are not related and I try to join tables in my query:
$builder = $this->em()->createQueryBuilder();
$builder->select('main')
->from($this->getEntityName(), 'main')
->leftJoin('\Bundle\Path\To\Article', 'a', 'WITH', 'a.id = main.articleID');
$query = $builder->getQuery();
$query->setHydrationMode(\Doctrine\ORM\AbstractQuery::HYDRATE_ARRAY);
$paginator = new \Doctrine\ORM\Tools\Pagination\Paginator($query);
return [
'success' => true,
'total' => $paginator->count(),
'data' => $paginator->getIterator()->getArrayCopy()
];
and I get this message:
Cannot count query which selects two FROM components, cannot make distinction
Anybody could help me with this issue ?