Skip to content


DDC-412: YAML can't handle multiple lifecycle events with one method #4905

doctrinebot opened this Issue · 6 comments

2 participants


Jira issue originally created by user @beberlei:

YAML uses the method as key and therefore can only register one lifecycle event per method. Annotations and XML dont have this limitation.


Comment created by shurakai:

I think we should simply flip the order in line 383 (instead of method => type use type => method). One would have to use

prePersist: doSomethingOnPrePersist

in that case. This should be easy enough to fix.

Remember to change documentation if this fix is accepted.


Comment created by @beberlei:

this wouldnt allow multiple methods per event.


Comment created by shurakai:

Benjamin, I got you wrong the first time - sorry. I've attached a patch and some tests that should fix this issue. The test also affects other drivers so the mapping files needed updating too.

Please make sure to update your models accordingly:

Former syntax:

{quote} methodname: lifecycle{quote}


{quote} lifecycle: [ method ]{quote}

Multiple methods:

{quote} lifecycle: [ method1, method2 ]{quote}

This should also be noted in the docs and especially in the upgrade instructions from Alpha4 to Beta1. Could you please take care of that?


Comment created by @beberlei:



Issue was closed with resolution "Fixed"

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.0-BETA1 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.