DDC-1309: Doctrine_Collection toArray() does not return results of table joins. #1640

Closed
opened 2026-01-22 13:20:45 +01:00 by admin · 3 comments
Owner

Originally created by @doctrinebot on GitHub (Aug 1, 2011).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user sharn.white:

e.g.
$doctrineCollection = Doctrine_Query::create()
->from('Table1 a')
->innerJoin('a.Table2 b ON a.id = b.id')
->execute();

$doctrineCollection->toArray() will return only the contents of Table1. However, $doctrineCollection->getFirst()->toArray() will return the results of Table1 + an additional key named 'Table2' which returns the join result from Table2.

It does not make sense for the collection hydration to differ to that of the objects in the collection.

Originally created by @doctrinebot on GitHub (Aug 1, 2011). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user sharn.white: e.g. $doctrineCollection = Doctrine_Query::create() ->from('Table1 a') ->innerJoin('a.Table2 b ON a.id = b.id') ->execute(); $doctrineCollection->toArray() will return only the contents of Table1. However, $doctrineCollection->getFirst()->toArray() will return the results of Table1 + an additional key named 'Table2' which returns the join result from Table2. It does not make sense for the collection hydration to differ to that of the objects in the collection.
admin added the Bug label 2026-01-22 13:20:45 +01:00
admin closed this issue 2026-01-22 13:20:46 +01:00
Author
Owner

@doctrinebot commented on GitHub (Aug 1, 2011):

Comment created by sharn.white:

If this is intended you can go ahead and trash this issue. Just doesn't seem right to me.

@doctrinebot commented on GitHub (Aug 1, 2011): Comment created by sharn.white: If this is intended you can go ahead and trash this issue. Just doesn't seem right to me.
Author
Owner

@doctrinebot commented on GitHub (Aug 1, 2011):

Comment created by sharn.white:

Nevermind. I should have been setting $deep to true.

@doctrinebot commented on GitHub (Aug 1, 2011): Comment created by sharn.white: Nevermind. I should have been setting $deep to true.
Author
Owner

@doctrinebot commented on GitHub (Aug 1, 2011):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Aug 1, 2011): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1640