1
0
mirror of synced 2025-02-03 05:49:25 +03:00
Luís Cobucci 62431ae477 Allow the usage of embedded objects on parent classes.
The `ClassMetadataInfo` was always using the "current class" to
fetch the reflection of a property even when a field is declared
on the parent class (which causes `ReflectionProperty` to throw
an exception).
2016-06-19 12:45:47 +02:00

33 lines
861 B
PHP

<?php
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\Tests\Models\DDC3303\DDC3303Address;
use Doctrine\Tests\Models\DDC3303\DDC3303Employee;
use Doctrine\Tests\OrmFunctionalTestCase;
class DDC3303Test extends OrmFunctionalTestCase
{
/**
* @before
*/
public function createSchema()
{
$this->_schemaTool->createSchema(array($this->_em->getClassMetadata(DDC3303Employee::class)));
}
public function testEmbeddedObjectsAreAlsoInherited()
{
$employee = new DDC3303Employee(
'John Doe',
new DDC3303Address('Somewhere', 123, 'Over the rainbow'),
'Doctrine Inc'
);
$this->_em->persist($employee);
$this->_em->flush();
$this->_em->clear();
$this->assertEquals($employee, $this->_em->find(DDC3303Employee::class, 1));
}
}