Doctrine2 ManyToMany doesn't execute listener events

廉价感情. 提交于 2019-12-01 12:37:29

So far, haven't found the best way BUT seems that Doctrine assumes that your Join Table will be "autogenerated" so it assumes that it doesn't have nor need more than the two joining keys (UserId, RoleId).

What I did to solve it was to stop using a ManyToMany, but use a OneToMany relationship to SecUserRole table. So inside the addSecRole method, I inserted the new object and then flushed the EM on the outside (like the example above).

It seems that's the best way I could do. I got the idea from this http://www.zendcasts.com/ where there is one cast specially for ManyToMany mappings.

Well, hope this helps to all

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!