Different mapping driver returns different isTransient() response for same class #6156

Open
opened 2026-01-22 15:27:53 +01:00 by admin · 6 comments
Owner

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.

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.
admin added the BugMissing Tests labels 2026-01-22 15:27:53 +01:00
Author
Owner

@alcaeus commented on GitHub (Jan 11, 2019):

This can happen depending on the platform. For example, MongoDB ODM has EmbeddedDocument and other non-root documents in the corresponding list in AnnotationDriver, so assuming that a mapping file is valid, both FileDriver and AnnotationDriver will 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?

@alcaeus commented on GitHub (Jan 11, 2019): This can happen depending on the platform. For example, MongoDB ODM has `EmbeddedDocument` and other non-root documents in the corresponding list in AnnotationDriver, so assuming that a mapping file is valid, both `FileDriver` and `AnnotationDriver` will 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?
Author
Owner

@notrix commented on GitHub (Jan 16, 2019):

IMHO it has nothing to do with platforms. doctrine/persistence lib 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.

@notrix commented on GitHub (Jan 16, 2019): IMHO it has nothing to do with platforms. `doctrine/persistence` lib 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.
Author
Owner

@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).

@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).
Author
Owner

@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?

@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?
Author
Owner

@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.

@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.
Author
Owner

@alcaeus commented on GitHub (Jan 16, 2019):

I don't fully understand the implications of changing this in ORM yet, as it may affect metadata loading.

Shouldn't be borked more than now since one driver already returns false 😉

@alcaeus commented on GitHub (Jan 16, 2019): > I don't fully understand the implications of changing this in ORM yet, as it may affect metadata loading. Shouldn't be borked more than now since one driver already returns `false` 😉
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6156