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?
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.
Here are the relevant docs: http://www.doctrine-project.org/docs/orm/2.1/en/reference/events.html#prepersist