Skip to content

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

Closed
fran6co wants to merge 1 commit intodoctrine:masterfrom
fran6co:fix-subclass-relation
Closed

Fixes case when an entity has a relationship with a class with joined inheritance#457
fran6co wants to merge 1 commit intodoctrine:masterfrom
fran6co:fix-subclass-relation

Conversation

@fran6co
Copy link
Contributor

@fran6co fran6co commented Sep 29, 2012

No description provided.

@doctrinebot
Copy link

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

@fran6co
Copy link
Contributor Author

fran6co commented Jun 23, 2013

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

@beberlei
Copy link
Member

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

@fran6co
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants