1
0
mirror of synced 2024-12-15 07:36:03 +03:00
doctrine2/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1707Test.php

67 lines
1.3 KiB
PHP
Raw Normal View History

2012-07-07 19:15:32 +04:00
<?php
namespace Doctrine\Tests\ORM\Functional\Ticket;
2012-08-01 03:10:36 +04:00
use Doctrine\ORM\Event\LifecycleEventArgs;
2012-07-07 19:15:32 +04:00
/**
* @group DDC-1707
*/
class DDC1707Test extends \Doctrine\Tests\OrmFunctionalTestCase
{
public function setUp()
{
parent::setUp();
try {
$this->_schemaTool->createSchema(array(
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1509File'),
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1509Picture'),
));
} catch (\Exception $ignored) {
}
}
public function testPostLoadOnChild()
{
2012-08-01 03:10:36 +04:00
$class = $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1707Child');
2012-07-07 19:15:32 +04:00
$entity = new DDC1707Child();
2012-08-01 03:10:36 +04:00
$event = new LifecycleEventArgs($entity, $this->_em);
$class->invokeLifecycleCallbacks(\Doctrine\ORM\Events::postLoad, $entity, $event);
2012-07-07 19:15:32 +04:00
$this->assertTrue($entity->postLoad);
}
}
/**
* @Entity
* @InheritanceType("SINGLE_TABLE")
* @DiscriminatorMap({"c": "DDC1707Child"})
* @HasLifecycleCallbacks
*/
abstract class DDC1707Base
{
/**
* @Id @Column(type="integer") @GeneratedValue
*/
protected $id;
public $postLoad = false;
/**
* @PostLoad
*/
public function onPostLoad()
{
$this->postLoad = true;
}
}
/**
* @Entity
*/
class DDC1707Child extends DDC1707Base
{
}