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 FieldDescription for multi-level embedded properties #830
Conversation
Can you add a test for this, please? |
Tests updated |
* @var bool | ||
*/ | ||
protected $plainField; | ||
} |
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 configure your IDE to always add a newline at end of file, this will make the red pictogram disappear.
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.
Should be OK
tests/Model/ModelManagerTest.php
Outdated
@@ -249,6 +250,10 @@ public function testGetParentMetadataForProperty() | |||
list($metadata, $lastPropertyName) = $modelManager | |||
->getParentMetadataForProperty($containerEntityClass, 'associatedEntity.embeddedEntity.plainField'); | |||
$this->assertEquals($metadata->fieldMappings[$lastPropertyName]['type'], 'boolean'); | |||
|
|||
list($metadata, $lastPropertyName) = $modelManager | |||
->getParentMetadataForProperty($containerEntityClass, 'associatedEntity.embeddedEntity.subEmbeddedEntity.plainField'); |
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.
Can you break this one more time? We follow PSR-2 and your line shouldn't be longer than 120 chars
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.
Done
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 find an official source showing that multi-level embeddables are supported by Doctrine.
@greg0ire /**
* @param string $class
*
* @return ClassMetadata
* @throws \RuntimeException
* @throws \ReflectionException
* @throws \Doctrine\Common\Persistence\Mapping\MappingException
*/
public function getMetadata($class)
{
try {
return $this->getEntityManager($class)->getMetadataFactory()->getMetadataFor($class);
} catch (\RuntimeException $exception) {
$metadata = $this->registry->getEntityManager()->getMetadataFactory()->getMetadataFor($class);
if ($metadata->isEmbeddedClass) {
return $metadata;
}
throw new \RuntimeException(sprintf('Failed to get metadata for class %s', $class),$exception);;
}
} |
Looking at doctrine/orm#1311, it seems indeed to be somewhat supported |
Nice simplicifaction 👍 |
I am targeting this branch, because it's BC bug fix..
Closes #826
Changelog
To do