Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / orm / tests / Doctrine / Tests / ORM / Functional / Ticket / DDC1707Test.php
1 <?php
2
3 namespace Doctrine\Tests\ORM\Functional\Ticket;
4
5 use Doctrine\ORM\UnitOfWork;
6
7 /**
8  * @group DDC-1707
9  */
10 class DDC1707Test extends \Doctrine\Tests\OrmFunctionalTestCase
11 {
12     public function setUp()
13     {
14         parent::setUp();
15
16         try {
17             $this->_schemaTool->createSchema(array(
18                 $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1509File'),
19                 $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1509Picture'),
20             ));
21         } catch (\Exception $ignored) {
22
23         }
24     }
25
26     public function testPostLoadOnChild()
27     {
28         $class = $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1707Child');
29         $entity = new DDC1707Child();
30         $class->invokeLifecycleCallbacks(\Doctrine\ORM\Events::postLoad, $entity);
31
32         $this->assertTrue($entity->postLoad);
33     }
34 }
35
36 /**
37  * @Entity
38  * @InheritanceType("SINGLE_TABLE")
39  * @DiscriminatorMap({"c": "DDC1707Child"})
40  * @HasLifecycleCallbacks
41  */
42 abstract class DDC1707Base
43 {
44     /**
45      * @Id @Column(type="integer") @GeneratedValue
46      */
47     protected $id;
48
49     public $postLoad = false;
50
51     /**
52      * @PostLoad
53      */
54     public function onPostLoad()
55     {
56         $this->postLoad = true;
57     }
58 }
59 /**
60  * @Entity
61  */
62 class DDC1707Child extends DDC1707Base
63 {
64 }