xpdo
xpdo copied to clipboard
setClassAlias() incompatible with queries run via ->getIterator()
Expected behavior:
$query = $xpdo->newQuery(<classA>::class);
$query->setClassAlias('A');
$query->innerJoin(<classB>::class>, 'B', ['B.fk_id = A.id']);
$iterator = $xpdo->getIterator(<classA>::class, $query);
... (expect objects retrieved in the $iterator to have successfully run the innerJoin)
Actual behavior: does not run the inner join as expected
I believe this doesn't just affect joins, but any operations where the class alias is used in the query.
Previous discussion on this includes but is not limited to the following:
xPDO->getIterator() assumes the class name is going to be the alias in the provided criteria you can manually build an xPDOIterator and provide an alias but there is no way to do that through getIterator()