Merge branch 'hotfix/#1381-wakeup-reflection-with-embeddable-and-staticreflection-serialization-fix-2.5' into 2.5
Close #1381
This commit is contained in:
commit
f9bbd953a7
@ -945,7 +945,7 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
}
|
||||
|
||||
foreach ($this->fieldMappings as $field => $mapping) {
|
||||
if (isset($mapping['declaredField'])) {
|
||||
if (isset($mapping['declaredField']) && isset($parentReflFields[$mapping['declaredField']])) {
|
||||
$this->reflFields[$field] = new ReflectionEmbeddedProperty(
|
||||
$parentReflFields[$mapping['declaredField']],
|
||||
$reflService->getAccessibleProperty($mapping['originalClass'], $mapping['originalField']),
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace Doctrine\Tests\ORM\Mapping;
|
||||
|
||||
use Doctrine\Common\Persistence\Mapping\RuntimeReflectionService;
|
||||
use Doctrine\Common\Persistence\Mapping\StaticReflectionService;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Doctrine\ORM\Events;
|
||||
use Doctrine\ORM\Mapping\DefaultNamingStrategy;
|
||||
@ -1125,6 +1126,30 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
||||
|
||||
$this->assertInstanceOf(__NAMESPACE__ . '\\MyArrayObjectEntity', $classMetadata->newInstance());
|
||||
}
|
||||
|
||||
public function testWakeupReflectionWithEmbeddableAndStaticReflectionService()
|
||||
{
|
||||
$classMetadata = new ClassMetadata('Doctrine\Tests\ORM\Mapping\TestEntity1');
|
||||
|
||||
$classMetadata->mapEmbedded(array(
|
||||
'fieldName' => 'test',
|
||||
'class' => 'Doctrine\Tests\ORM\Mapping\TestEntity1',
|
||||
'columnPrefix' => false,
|
||||
));
|
||||
|
||||
$field = array(
|
||||
'fieldName' => 'test.embeddedProperty',
|
||||
'type' => 'string',
|
||||
'originalClass' => 'Doctrine\Tests\ORM\Mapping\TestEntity1',
|
||||
'declaredField' => 'test',
|
||||
'originalField' => 'embeddedProperty'
|
||||
);
|
||||
|
||||
$classMetadata->mapField($field);
|
||||
$classMetadata->wakeupReflection(new StaticReflectionService());
|
||||
|
||||
$this->assertEquals(array('test' => null, 'test.embeddedProperty' => null), $classMetadata->getReflectionProperties());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user