Fixed the typo, and method 'doOtherStuffOnPrePersist' called when
persist() is performed. New problem arises, I need to pass a parameter
setted in configl.yml and defined in DIC. This parameter is accessed
from de Controller using $this->container->getParameter('myparameter')
but from the callable (doOherStuffOnPrePersist) method implemented in
a entity object?
My solution is to pass this parameter to the entity object when
created in the Controller, but any better/clean solution?Thanks again. On Jan 22, 3:28 pm, Carlos Sánchez <[email protected]> wrote: > Great! > > Thanks for your help. > > On Jan 22, 12:44 pm, ivarne <[email protected]> wrote: > > > Therehttps://github.com/doctrine/orm-documentation/pull/15 > > > On 22 Jan, 12:31, ivarne <[email protected]> wrote: > > > > 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 > > > onhttp://www.doctrine-project.org/projects/orm/2.0/docs/whats-new/en. > > > >YAMLMapping Driver > > > > The way to specify lifecycle callbacks inYAMLMapping 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 usingyamlannotation 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
