xpdo icon indicating copy to clipboard operation
xpdo copied to clipboard

setClassAlias() incompatible with queries run via ->getIterator()

Open mkschell opened this issue 1 year ago • 1 comments

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.

mkschell avatar Oct 31 '24 15:10 mkschell

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()

mkschell avatar Oct 31 '24 15:10 mkschell