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

Closed
opened 2026-01-22 12:41:00 +01:00 by admin · 6 comments
Owner

Originally created by @doctrinebot on GitHub (Mar 11, 2010).

Originally assigned to: @beberlei on GitHub.

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.

Originally created by @doctrinebot on GitHub (Mar 11, 2010). Originally assigned to: @beberlei on GitHub. 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.
admin added the Bug label 2026-01-22 12:41:00 +01:00
admin closed this issue 2026-01-22 12:41:00 +01:00
Author
Owner

@doctrinebot commented on GitHub (Mar 11, 2010):

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.

@doctrinebot commented on GitHub (Mar 11, 2010): 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.
Author
Owner

@doctrinebot commented on GitHub (Mar 12, 2010):

Comment created by @beberlei:

this wouldnt allow multiple methods per event.

prePersist:
  doSomethingOnPrePersist1
  doSomethingOnPrePersist2
@doctrinebot commented on GitHub (Mar 12, 2010): Comment created by @beberlei: this wouldnt allow multiple methods per event. ``` prePersist: doSomethingOnPrePersist1 doSomethingOnPrePersist2 ```
Author
Owner

@doctrinebot commented on GitHub (Mar 14, 2010):

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}

now:

{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?

@doctrinebot commented on GitHub (Mar 14, 2010): 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} now: {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?
Author
Owner

@doctrinebot commented on GitHub (Mar 15, 2010):

Comment created by @beberlei:

Fixed

@doctrinebot commented on GitHub (Mar 15, 2010): Comment created by @beberlei: Fixed
Author
Owner

@doctrinebot commented on GitHub (Mar 15, 2010):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Mar 15, 2010): Issue was closed with resolution "Fixed"
Author
Owner

@doctrinebot commented on GitHub (Dec 13, 2015):

Imported 1 attachments from Jira into https://gist.github.com/092f3d72badf2d6316b6

@doctrinebot commented on GitHub (Dec 13, 2015): Imported 1 attachments from Jira into https://gist.github.com/092f3d72badf2d6316b6 - [10460_yaml_multiple_lifecycles.patch](https://gist.github.com/092f3d72badf2d6316b6#file-10460_yaml_multiple_lifecycles-patch)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#514