Ok, it seems I was just missing 

use Symfony\Component\Validator\Constraints;

Le lundi 5 janvier 2015 12:49:54 UTC+1, Alain Diart a écrit :
>
> Hi,
>
> First of all, happy new year ! :)
>
> Well, I've got one entity that extends another one using the Joined 
> InheritanceType. In this entity I'd like to execute code on PostPersist, 
> but the code is never called.
>
> What could be wrong ?
>
> namespace My\MyBundle\Entity;
>
> use Gedmo\Mapping\Annotation as Gedmo;
> use Doctrine\ORM\Mapping AS ORM;
> use Doctrine\ORM\Event;
>
> /**
>  * @ORM\Entity
>  * @ORM\HasLifecycleCallbacks
>  * @ORM\Table(name="bts_Items")
>  *
>  * @ORM\DiscriminatorMap({
>  *   "item"="My\MyBundle\Entity\Item",
>  *   "product"="My\MyBundle\Entity\Product"
>  * })
>  * @ORM\DiscriminatorColumn(name="element_type", fieldName="elementType", 
> type="string")
>  * @ORM\InheritanceType("JOINED")
>  */
> class Item
> {
>     // ...
> }
>
>
>
> namespace My\MyBundle\Entity;
>
> use Doctrine\ORM\Mapping AS ORM;
> use Doctrine\ORM\Event;
>
> /**
>  * @ORM\Entity
>  * @ORM\HasLifecycleCallbacks
>  * @ORM\Table(name="bts_Products")
>  */
> class Product extends Item
> {
>     /**
>      * @ORM\PostPersist()
>      * @ORM\PostUpdate()
>      *
>      * @param \Doctrine\ORM\Event\LifecycleEventArgs $args
>      */
>     public function doFunkyStuffOnProducts(Event\LifecycleEventArgs $args)
>     {
>         // do funky stuff but never get called
>     }
> }
>
> Thanks !
>
> Alain
>

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to