Uploaded image for project: 'Doctrine 2 - ORM'
  1. Doctrine 2 - ORM
  2. DDC-412

YAML can't handle multiple lifecycle events with one method

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0-ALPHA4
    • Fix Version/s: 2.0-BETA1
    • Component/s: Mapping Drivers
    • Security Level: All
    • Labels:
      None

      Description

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

        Activity

        Hide
        shurakai Christian Heinrich added a comment -

        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.

        Show
        shurakai Christian Heinrich added a comment - 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.
        Hide
        beberlei Benjamin Eberlei added a comment -

        this wouldnt allow multiple methods per event.

        prePersist:
          doSomethingOnPrePersist1
          doSomethingOnPrePersist2
        
        Show
        beberlei Benjamin Eberlei added a comment - this wouldnt allow multiple methods per event. prePersist: doSomethingOnPrePersist1 doSomethingOnPrePersist2
        Hide
        shurakai Christian Heinrich added a comment -

        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:

        methodname: lifecycle

        now:

        lifecycle: [ method ]

        Multiple methods:

        lifecycle: [ method1, method2 ]

        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?

        Show
        shurakai Christian Heinrich added a comment - 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: methodname: lifecycle now: lifecycle: [ method ] Multiple methods: lifecycle: [ method1, method2 ] 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?
        Hide
        beberlei Benjamin Eberlei added a comment -

        Fixed

        Show
        beberlei Benjamin Eberlei added a comment - Fixed

          People

          • Assignee:
            beberlei Benjamin Eberlei
            Reporter:
            beberlei Benjamin Eberlei
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: