From 3783ca6b43efbc2163eeaa3a32f3ad99175cea17 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sat, 7 Jul 2012 17:15:32 +0200 Subject: [PATCH] [DDC-1707] Working testcase --- .../ORM/Functional/Ticket/DDC1707Test.php | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1707Test.php diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1707Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1707Test.php new file mode 100644 index 000000000..50e702d99 --- /dev/null +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1707Test.php @@ -0,0 +1,64 @@ +_schemaTool->createSchema(array( + $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1509File'), + $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1509Picture'), + )); + } catch (\Exception $ignored) { + + } + } + + public function testPostLoadOnChild() + { + $class = $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1707Child'); + $entity = new DDC1707Child(); + $class->invokeLifecycleCallbacks(\Doctrine\ORM\Events::postLoad, $entity); + + $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 +{ +}