mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Different mapping driver returns different isTransient() response for same class #6156
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @notrix on GitHub (Jan 11, 2019).
I have issue with embeddable class where:
AnnotationDriver returns
isTransient() === true
And FileDriver
isTransient() === false
AnnotationDriver skips classes that are not in \Doctrine\ORM\Mapping\Driver\AnnotationDriver::$entityAnnotationClasses
FileDriver accepts all classes if file exists (embeddable included)
jms/serializer doctrine object constructor depends on isTransient() response and with embeddable class if fails to construct object.
@alcaeus commented on GitHub (Jan 11, 2019):
This can happen depending on the platform. For example, MongoDB ODM has
EmbeddedDocumentand other non-root documents in the corresponding list in AnnotationDriver, so assuming that a mapping file is valid, bothFileDriverandAnnotationDriverwill return the same value when queried for that class. I would assume this is a discrepancy in ORM.@Majkl578 what do you think? Is this a general issue that we want to look at or is this an ORM-specific issue?
@notrix commented on GitHub (Jan 16, 2019):
IMHO it has nothing to do with platforms.
doctrine/persistencelib has drivers that behaves differently.Third party libs should not care which driver is used to collect class metadata.
Either annotation driver should consider all possible entity annotations (embeddable included) or file driver should look whats inside class metadata file and not just check if it exists.
@Ocramius commented on GitHub (Jan 16, 2019):
An embeddable is indeed transient, as it cannot be persisted on its own (hence transient when seen without parent entity context): this should be corrected in the annotationdriver (in ORM).
@notrix commented on GitHub (Jan 16, 2019):
If embeddable is transient, so annotation driver works as expected. File driver does not check file content and returns false on isTransient(EmbeddableClass). Should I create new issue in ORM lib?
@Ocramius commented on GitHub (Jan 16, 2019):
I'd suggest directly writing a failing test case for ORM, if possible.
I don't fully understand the implications of changing this in ORM yet, as it may affect metadata loading.
@alcaeus commented on GitHub (Jan 16, 2019):
Shouldn't be borked more than now since one driver already returns
false😉