DDC-2915: When there are 2 identical aliases in an object hydrated dql query tied to a relation, some times it retrives an empty relation #3629

Closed
opened 2026-01-22 14:24:14 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Jan 14, 2014).

Originally assigned to: @Ocramius on GitHub.

Jira issue originally created by user willf1976:

Hi

I recently had a problem with a Dql query I wrote where when I had a typo in my select which resulted in a very odd behavior. At a predictable row number one of the relations wouldn't hydrate.

This resulted in the fatal error when I tried to access the relation like so: $row->getLolGameSize()->getName()

Call to a member function getName() on a non-object

Here is the query that causes the problem -- removing the second reference to lgs in the select fixes the problem.

SELECT lst, ls, lr, lt, lstlt, lgt, lgs, lgs, ats
FROM Team\Entity\Lolsummonertournament lst
INNER JOIN lst.lolSummoner ls
INNER JOIN ls.lolRank lr
INNER JOIN ls.lolTier lt
LEFT JOIN lst.lolTier lstlt
INNER JOIN lst.lolGameType lgt
INNER JOIN lst.lolGameSize lgs
INNER JOIN lst.attendanceStatus ats
WHERE lst.tournament = :tournamentId
AND ls.summonerId IS NOT NULL
AND ls.mmr IS NOT NULL
ORDER BY ls.mmr desc

All the best

Originally created by @doctrinebot on GitHub (Jan 14, 2014). Originally assigned to: @Ocramius on GitHub. Jira issue originally created by user willf1976: Hi I recently had a problem with a Dql query I wrote where when I had a typo in my select which resulted in a very odd behavior. At a predictable row number one of the relations wouldn't hydrate. This resulted in the fatal error when I tried to access the relation like so: $row->getLolGameSize()->getName() Call to a member function getName() on a non-object Here is the query that causes the problem -- removing the second reference to lgs in the select fixes the problem. SELECT lst, ls, lr, lt, lstlt, lgt, lgs, lgs, ats FROM Team\Entity\Lolsummonertournament lst INNER JOIN lst.lolSummoner ls INNER JOIN ls.lolRank lr INNER JOIN ls.lolTier lt LEFT JOIN lst.lolTier lstlt INNER JOIN lst.lolGameType lgt INNER JOIN lst.lolGameSize lgs INNER JOIN lst.attendanceStatus ats WHERE lst.tournament = :tournamentId AND ls.summonerId IS NOT NULL AND ls.mmr IS NOT NULL ORDER BY ls.mmr desc All the best
admin added the Bug label 2026-01-22 14:24:14 +01:00
admin closed this issue 2026-01-22 14:24:14 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jan 14, 2014):

Comment created by @ocramius:

Fetch joining on filtered associations is very dangerous and unsupported.

@doctrinebot commented on GitHub (Jan 14, 2014): Comment created by @ocramius: Fetch joining on filtered associations is very dangerous and unsupported.
Author
Owner

@doctrinebot commented on GitHub (Jan 14, 2014):

Issue was closed with resolution "Invalid"

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

No dependencies set.

Reference: doctrine/archived-orm#3629