#1130 DDC-3300 - fixed inheritance maps where inheritance members were missing
This commit is contained in:
parent
a36bea2951
commit
b7c28924b1
@ -5,7 +5,7 @@ namespace Doctrine\Tests\Models\CompositeKeyInheritance;
|
||||
* @Entity
|
||||
* @InheritanceType("JOINED")
|
||||
* @DiscriminatorColumn(name="discr", type="string")
|
||||
* @DiscriminatorMap({"child" = "JoinedChildClass",})
|
||||
* @DiscriminatorMap({"child" = "JoinedChildClass", "root" = "JoinedRootClass"})
|
||||
*/
|
||||
class JoinedRootClass
|
||||
{
|
||||
|
@ -5,7 +5,7 @@ namespace Doctrine\Tests\Models\CompositeKeyInheritance;
|
||||
* @Entity
|
||||
* @InheritanceType("SINGLE_TABLE")
|
||||
* @DiscriminatorColumn(name="discr", type="string")
|
||||
* @DiscriminatorMap({"child" = "SingleChildClass",})
|
||||
* @DiscriminatorMap({"child" = "SingleChildClass", "root" = "SingleRootClass"})
|
||||
*/
|
||||
class SingleRootClass
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ class DDC1113Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
/**
|
||||
* @Entity
|
||||
* @InheritanceType("SINGLE_TABLE")
|
||||
* @DiscriminatorMap({"car" = "DDC1113Car", "bus" = "DDC1113Bus"})
|
||||
* @DiscriminatorMap({"vehicle" = "DDC1113Vehicle", "car" = "DDC1113Car", "bus" = "DDC1113Bus"})
|
||||
*/
|
||||
class DDC1113Vehicle
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ class DDC1454Picture extends DDC1454File
|
||||
* @Entity
|
||||
* @InheritanceType("JOINED")
|
||||
* @DiscriminatorColumn(name="discr", type="string")
|
||||
* @DiscriminatorMap({"picture" = "DDC1454Picture"})
|
||||
* @DiscriminatorMap({"file" = "DDC1454File", "picture" = "DDC1454Picture"})
|
||||
*/
|
||||
class DDC1454File
|
||||
{
|
||||
|
@ -115,7 +115,7 @@ class DDC1509Picture
|
||||
* @Entity
|
||||
* @InheritanceType("SINGLE_TABLE")
|
||||
* @DiscriminatorColumn(name="discr", type="string")
|
||||
* @DiscriminatorMap({"file" = "DDC1509File"})
|
||||
* @DiscriminatorMap({"abstractFile" = "DDC1509AbstractFile", "file" = "DDC1509File"})
|
||||
*/
|
||||
class DDC1509AbstractFile
|
||||
{
|
||||
|
@ -33,7 +33,7 @@ class DDC1787Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
* @Entity
|
||||
* @InheritanceType("JOINED")
|
||||
* @DiscriminatorColumn(name="discr", type="string")
|
||||
* @DiscriminatorMap({"bar" = "DDC1787Bar"})
|
||||
* @DiscriminatorMap({"bar" = "DDC1787Bar", "foo" = "DDC1787Foo"})
|
||||
*/
|
||||
class DDC1787Foo
|
||||
{
|
||||
|
@ -71,7 +71,8 @@ class DDC2012Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
* @InheritanceType("JOINED")
|
||||
* @DiscriminatorColumn(name="type_id", type="smallint")
|
||||
* @DiscriminatorMap({
|
||||
* 1 = "DDC2012ItemPerson"
|
||||
* 1 = "DDC2012ItemPerson",
|
||||
* 2 = "DDC2012Item"
|
||||
* })
|
||||
*/
|
||||
class DDC2012Item
|
||||
|
@ -88,7 +88,7 @@ class DDC2346Foo
|
||||
* @Entity
|
||||
* @InheritanceType("JOINED")
|
||||
* @DiscriminatorColumn(name="discr", type="string")
|
||||
* @DiscriminatorMap({"baz" = "DDC2346Baz"})
|
||||
* @DiscriminatorMap({"bar" = "DDC2346Bar", "baz" = "DDC2346Baz"})
|
||||
*/
|
||||
class DDC2346Bar
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket;
|
||||
|
||||
use Doctrine\ORM\Events;
|
||||
use Doctrine\ORM\Tools\ResolveDiscriminatorMapListener;
|
||||
use Doctrine\ORM\Tools\ResolveTargetEntityListener;
|
||||
|
||||
/**
|
||||
* @group DDC-3300
|
||||
@ -12,21 +13,28 @@ class DDC3300Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
{
|
||||
public function testIssue()
|
||||
{
|
||||
$this
|
||||
->_em
|
||||
->getEventManager()
|
||||
->addEventListener(
|
||||
Events::loadClassMetadata,
|
||||
new ResolveDiscriminatorMapListener(array(
|
||||
'Doctrine\Tests\ORM\Functional\Ticket\DDC3300BossInterface' => 'Doctrine\Tests\ORM\Functional\Ticket\DDC3300Boss',
|
||||
'Doctrine\Tests\ORM\Functional\Ticket\DDC3300EmployeeInterface' => 'Doctrine\Tests\ORM\Functional\Ticket\DDC3300Employee',
|
||||
))
|
||||
);
|
||||
$resolveTargetEntity = new ResolveTargetEntityListener();
|
||||
|
||||
$resolveTargetEntity->addResolveTargetEntity(
|
||||
DDC3300BossInterface::INTERFACENAME,
|
||||
DDC3300Boss::CLASSNAME,
|
||||
array()
|
||||
);
|
||||
|
||||
$resolveTargetEntity->addResolveTargetEntity(
|
||||
DDC3300EmployeeInterface::INTERFACENAME,
|
||||
DDC3300Employee::CLASSNAME,
|
||||
array()
|
||||
);
|
||||
|
||||
$this->_em->getEventManager()->addEventSubscriber($resolveTargetEntity);
|
||||
|
||||
$this->_schemaTool->createSchema(array(
|
||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC3300Person'),
|
||||
$this->_em->getClassMetadata(DDC3300Person::CLASSNAME),
|
||||
));
|
||||
|
||||
//die(var_dump($this->_em->getClassMetadata(DDC3300Person::CLASSNAME)->discriminatorMap));
|
||||
|
||||
$boss = new DDC3300Boss();
|
||||
$this->_em->persist($boss);
|
||||
|
||||
@ -48,6 +56,8 @@ class DDC3300Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
*/
|
||||
abstract class DDC3300Person
|
||||
{
|
||||
const CLASSNAME = __CLASS__;
|
||||
|
||||
/**
|
||||
* @Id
|
||||
* @Column(type="integer")
|
||||
@ -58,7 +68,7 @@ abstract class DDC3300Person
|
||||
|
||||
interface DDC3300BossInterface
|
||||
{
|
||||
|
||||
const INTERFACENAME = __CLASS__;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -66,11 +76,12 @@ interface DDC3300BossInterface
|
||||
*/
|
||||
class DDC3300Boss extends DDC3300Person implements DDC3300BossInterface
|
||||
{
|
||||
const CLASSNAME = __CLASS__;
|
||||
}
|
||||
|
||||
interface DDC3300EmployeeInterface
|
||||
{
|
||||
|
||||
const INTERFACENAME = __CLASS__;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,5 +89,6 @@ interface DDC3300EmployeeInterface
|
||||
*/
|
||||
class DDC3300Employee extends DDC3300Person implements DDC3300EmployeeInterface
|
||||
{
|
||||
const CLASSNAME = __CLASS__;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user