In Doctrine2 is it possible to invoke lifecycle callbacks in a base class, which all entities inherit from.
Something like this http://pastie.org/2650901
The problem is that validationCheck()
method doesn't get invoked when I persist or update an entity.
Also, I tried making the base class @MappedSuperclass
, but then it breaks all further inheritance, and that i开发者_JAVA百科s not an option.
Got it working, my mistake.
Here is the solution, if anyone else stumbles on the same issue.
Base class has to have a @MappedSuperclass
and @HasLifecycleCallbacks
notation.
Entity class, if uses further inheritance, has to be abstract
.
http://pastie.org/2661834
精彩评论