It's a bug in the doctrine documentation. The syntax was changed from ALFA4 to BETA1 to make it more intuitive. The correct syntax is given on http://www.doctrine-project.org/projects/orm/2.0/docs/whats-new/en.
YAML Mapping Driver The way to specify lifecycle callbacks in YAML Mapping driver was changed to allow for multiple callbacks per event. The Old syntax ways: --- lifecycleCallbacks: doStuffOnPrePersist: prePersist doStuffOnPostPersist: postPersist The new syntax is: --- lifecycleCallbacks: prePersist: [ doStuffOnPrePersist, doOtherStuffOnPrePersistToo ] postPersist: [ doStuffOnPostPersist ] I'll try to make a pull request on the doctrine documentation later today. Regards Ivar On 22 Jan, 12:12, Carlos Sánchez <[email protected]> wrote: > Hi all, > > I'm experimenting with doctrine entity life cyle events. > As explained > inhttp://docs.symfony-reloaded.org/master/guides/doctrine/orm/configura..., > i've created a listener and subscribed it to dbal using DIC. no > problem, works great! > > The problem is that within the listener I have to work at Unit Of Work > Level, not at entity level (I might be wrong at this) > > To make things simpler I just created using yaml annotation and as > explained > inhttp://www.doctrine-project.org/docs/orm/2.0/en/reference/events.html... > some callbacks on persist event: > > .... > lifecycleCallbacks: > doStuffOnPrePersist: prePersist > ... > > when generating entities using console doctrine:generate:entities I > get the following error: > > Warning: Invalid argument supplied for foreach() in /var/www/symfony- > sandbox/src/vendor/doctrine/lib/Doctrine/ORM/Mapping/Driver/ > YamlDriver.php on line 414 > > And of course method callback is never called. > is YamlDriver parsing or no parsing lifecycleCallbacks properly? > > Any idea. > > Thanks in advanced. -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en
