added DiscriminatorMapEntry mapping #533

Closed
wants to merge 5 commits into
from

Projects

None yet

6 participants

@Padam87
Padam87 commented Dec 11, 2012

In Symfony2, if the main entity is in a separate bundle, from a vendor, changing the DiscriminatorMap is not a good idea.
Thats why we should be able to add entries to the map.

Mapping:

yaml:

discriminatorMapEntry: keyHere

annotation:

@DiscriminatorMapEntry("keyHere")

xml:

@doctrinebot
Collaborator

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-2195

@guilhermeblanco
Member

That is not enough.
Also, the main class needs to know about its subClasses and parentClasses.

@Padam87
Padam87 commented Dec 11, 2012

Thanks, on it.

@Majkl578

👍 Really useful, until now, there were some user-land implementations through listeners, e.g.: this DiscriminatorMapDiscovery.

Also, add some tests. :)

@Padam87
Padam87 commented Dec 11, 2012

We were using this one: https://github.com/Netpositive/NetpositiveDiscriminatorMapBundle

But there were some major issues. Fails in prod env with the latest doctrine.

@beberlei
Member

This is actually not necessary anymore, since 2.2 or 2.3 (not sure) Doctrine has a feature where @InheritanceType without @DiscriminatorMap leads to an auto-detection of the map.

@beberlei beberlei closed this Dec 16, 2012
@Padam87
Padam87 commented Dec 16, 2012

@beberlei Yep, I know. But if two entities have the same class name, the auto-detection fails, and throws an exception.

Maybe instead of this solution you could inluce the namespace in the auto-detection naming.

@Padam87 Padam87 referenced this pull request in Netpositive/NetpositiveDiscriminatorMapBundle Jan 4, 2013
Closed

Problem clearing cache in prod-environment #3

@skilltryck

+1
Also having this problem...

@Majkl578
Majkl578 commented Oct 4, 2013

Bumping this.

This is actually not necessary anymore

@beberlei: I disagree. This is much cleaner than auto-detection which:
a) collides for entities of same name in different namespace,
b) breaks in terrible way when class is renamed,
c) is ugly (generates unnecesarily too long discriminator columns).

@Padam87
Padam87 commented Oct 6, 2013

@Majkl578 I agree, obviously. :) Plus it should be faster than auto detecting.

@Padam87
Padam87 commented Apr 28, 2014

Bumping this again. @beberlei Is there any way that a feature like this could be merged? It's really annyoing to work with when you run into this issue.

@Padam87
Padam87 commented Jun 22, 2015

@beberlei Bumping again, as today we came across this issue again.

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