-
-
Save doctrinebot/73ee018a6104b0106503 to your computer and use it in GitHub Desktop.
Attachments to Doctrine Jira Issue DDC-1034 - https://github.com/doctrine/doctrine2/issues/1623
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Che\Tmp; | |
/** | |
* @Entity | |
* @HasLifecycleCallbacks | |
* @InheritanceType("JOINED") | |
* @DiscriminatorColumn(name="discr", type="string") | |
* @DiscriminatorMap({ | |
* "derived" = "Che\Tmp\DerivedClass" | |
* }) | |
*/ | |
abstract class BaseClass | |
{ | |
/** | |
* @Id | |
* @Column(type="integer", name="id") | |
* @GeneratedValue | |
*/ | |
protected $id; | |
protected $list; | |
/** | |
* @PostLoad | |
*/ | |
public function PostLoadBase() | |
{ | |
echo 'Called '.__METHOD__."\n"; | |
$this->list = new \Doctrine\Common\Collections\ArrayCollection(); | |
$this->list[] = 'base value'; | |
} | |
} | |
/** | |
* @Entity | |
* @HasLifecycleCallbacks | |
*/ | |
class DerivedClass extends BaseClass | |
{ | |
/** | |
* @PostLoad | |
*/ | |
public function PostLoadDerived() | |
{ | |
echo 'Called '.__METHOD__."\n"; | |
$this->list[] = 'derived value'; | |
} | |
public function EchoList() | |
{ | |
echo '('; | |
echo implode(', ', $this->list->toArray()); | |
echo ')'; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment