Fixes case when an entity has a relationship with a class with joined inheritance #457

Closed
wants to merge 1 commit into
from

Projects

None yet

3 participants

Contributor
fran6co commented Sep 29, 2012

No description provided.

Hello,

thank you for positing this Pull Request. I have automatically opened an issue on our Jira Bug Tracker for you with the details of this Pull-Request. See the Link:

http://doctrine-project.org/jira/browse/DDC-2048

Contributor
fran6co commented Jun 23, 2013

I rebased this PR. Should I do something else to get this fixed?

Owner

@fran6co I haven't had time to evaluate this yet, can you say what goes wrong when you don't have this fix applied?

Contributor
fran6co commented Jun 25, 2013

@beberlei I think it doesn't make sense looking it now, I think this use case can be avoided by using the full name class in the DQL.

The idea was to be able to work with subclasses of relationships. For example, CompanyOrganization has many events, but events can be of different type (CompanyAuction or CompanyRaffle). I couldn't figure out a nice way to get just a specific type (all auctions or all raffles) or to get CompanyOrganization that have auctions with some specific value. So, I added a OneToMany relationship to CompanyOrganization named auctions. Doctrine handles that well in most of the cases but fails when I try to do something like this:

select c from Doctrine\Tests\Models\Company\CompanyOrganization c INNER JOIN c.auctions a WHERE a.data = ?1

But I think it can be solved just with DQL by doing this:

select c from Doctrine\Tests\Models\Company\CompanyOrganization c JOIN Doctrine\Tests\Models\Company\CompanyAuction a WITH a.organization = c WHERE a.data = ?1
@fran6co fran6co closed this Jun 25, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment