1
0
mirror of synced 2025-01-18 22:41:43 +03:00

#1130 DDC-3300 - fixed inheritance maps where inheritance members were missing

This commit is contained in:
Marco Pivetta 2015-01-15 03:48:53 +01:00
parent a36bea2951
commit b7c28924b1
9 changed files with 34 additions and 21 deletions

View File

@ -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
{

View File

@ -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
{

View File

@ -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
{

View File

@ -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
{

View File

@ -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
{

View File

@ -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
{

View File

@ -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

View File

@ -88,7 +88,7 @@ class DDC2346Foo
* @Entity
* @InheritanceType("JOINED")
* @DiscriminatorColumn(name="discr", type="string")
* @DiscriminatorMap({"baz" = "DDC2346Baz"})
* @DiscriminatorMap({"bar" = "DDC2346Bar", "baz" = "DDC2346Baz"})
*/
class DDC2346Bar
{

View File

@ -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__;
}