-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Do not persist embeddables #44
Conversation
151a9b6
to
f853cb5
Compare
|
||
if ($this->persist) { | ||
|
||
if ($this->persist && (!property_exists($entityMetadata, 'isEmbeddedClass') || false === $entityMetadata->isEmbeddedClass)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is too verbose, but the field may not yet exist, so I better check for its existence.
For reference, see
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, that's ok
f853cb5
to
e4775ed
Compare
No idea why most of the tests are failing, to be honest. |
I never really used embeddables so I might be not of much help here. Build failures is definitely related to the changes in this branch. I just rerun the build on latest master and everything looks ok. You might want to temporarily disable |
b38fed0
to
d344f04
Compare
Ha, build failure was caused by
|
201e827
to
c86b6fa
Compare
Build failure is related to doctrine/orm#6462. Taking a look later. |
Just realized that this is also a problem when |
12e9f8a
to
de6d113
Compare
52f3d5c
to
f85f34c
Compare
$this->em->persist($ent); | ||
} | ||
|
||
return $ent; | ||
} | ||
|
||
private static function canPersist(Mapping\ClassMetadata $classMetadata): bool | ||
{ | ||
if (!property_exists($classMetadata, 'isEmbeddedClass')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This library requires doctrine/orm 2.6.3. The property should be available in all orm versions since then: https://github.com/doctrine/orm/blob/v2.6.3/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php#L270
f85f34c
to
4e1ac25
Compare
Thank you! |
Thank you, @glaubinix! |
This PR
πββοΈ Not sure, but I think it would be nice if we could write definitions for embeddables as well. When turning automatic persisting on, the fixture factory attempts to persist them, though, and this will fail because they do not have an identity.