Hello Nima, You should send a pull request against https://github.com/doctrine/doctrine2/tree/master/docs/en instead :-)
Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On 14 December 2014 at 19:04, Nima Sadjadi <[email protected]> wrote: > > > As about Entity listeners: > http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html#entity-listeners > I just wanted to contribute a comment to docs for php entity mappings: > to register an entity listener class, the following line can be used in > php entity class: > $metadata->addEntityListener('preFlush', 'FlushListener', > 'preFlushHandler'); > first parameter is $event, second param is $class and third param is > mapped $method in class to that event. > for callback functions, the following line can be used: > $metadata->setLifecycleCallbacks(array ('preFlush' => > array('doSomethingPreFlush'))); > the array key is $event and array value is the method in entity class for > that event. > I also found some outdated methods on wiki: > http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html#listening-and-subscribing-to-lifecycle-events > $entity = $args->getObject(); > $entityManager = $args->getObjectManager(); > should be changed to getEntity() and getEntityManager() with current orm > version. > Hope this is useful for someone. > > > -- > You received this message because you are subscribed to the Google Groups > "doctrine-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/doctrine-user. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/d/optout.
