开发者

Doctrine2 lifecycle callbacks in base class?

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜