原则2 PreInsert等效? [英] Doctrine 2 PreInsert equivalent?

查看:239
本文介绍了原则2 PreInsert等效?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我明白Doctrine2中没有PreInsert监听器,对吧?
是等价网络PrePersist吗?如果是,如何检查对象是否被插入或更新?

I understand there is no PreInsert listener in Doctrine2, right? Is the equivalnet PrePersist? And if so, how do I check if the object is being inserted or updated?

谢谢!

推荐答案

对于所有意图和目的,PrePersist是PreInsert。不会为仅更新的实体调用 - 您可以使用PreUpdate。

For all intents and purposes PrePersist is PreInsert. it will not be called for entities that are only updated - you can use PreUpdate for that.

以下是相关文档: http://www.doctrine-project.org/docs/orm/2.1/en/reference /events.html#prepersist

这篇关于原则2 PreInsert等效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆