-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 #6460 - \Doctrine\ORM\Mapping\ClassMetadataInfo::hasField should return true for embedded fields #6462
Fix #6460 - \Doctrine\ORM\Mapping\ClassMetadataInfo::hasField should return true for embedded fields #6462
Conversation
… should return true for embedded fields
$this->_em->getClassMetadata(DDC6460ParentEntity::class), | ||
] | ||
); | ||
} catch (\Exception $e) { |
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.
Please only catch schemaexception
->getClassMetadata(DDC6460Entity::class) | ||
->hasField('embedded'); | ||
|
||
$this->assertTrue($isFieldMapped); |
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 test should probably be on the class metadata tests
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.
I've added similar test there
|
||
$proxy = $this->_em->getRepository(DDC6460ParentEntity::class)->findOneById(1); | ||
|
||
$this->assertNotNull($proxy->lazyLoaded->embedded); |
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.
Please use self::assertInstanceOf()
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.
I would also check the value of field
after this call
$second->id = 1; | ||
$second->lazyLoaded = $entity; | ||
$this->_em->persist($second); | ||
$this->_em->flush(); |
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.
Why two flush operations?
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.
I've added cascade persist in order to remove one flush
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.
Thanks!
|
||
$this->_em->clear(); | ||
|
||
$proxy = $this->_em->getRepository(DDC6460ParentEntity::class)->findOneById(1); |
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 is not a proxy here: please add assertions to verify if it is a proxy, and if it is loaded
$second->id = 1; | ||
$second->lazyLoaded = $entity; | ||
$this->_em->persist($second); | ||
$this->_em->flush(); |
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.
Thanks!
LGTM! 👍 Note that I'm not changing this for |
This fixes #6460