Hi there! Actually, doctrine events are dispatched and have the same listeners in a console command as they do in the web context - there's absolutely no difference. As long as you have the container, it's been built to configure the doctrine services to have these listeners, and the container in a controller is the exact same container as you have from within a controller. So, double-check your code - events are firing :). The 2 issues you referenced aren't talking about Doctrine events in the CLI, they're talking about adding some lifecycle events to Symfony's dispatcher related to the CLI environment itself initializing and finishing.
If you have any other questions, check out the Symfony2 google group - someone will correct me if I'm wrong, but I don't think there's any Symfony issues here. Good luck and cheers! Ryan On Feb 15, 2013, at 10:11 AM, b7kich <b8k...@gmail.com> wrote: > I found the lifecycle events I have declared for my doctrine entities are not > getting called in the context of a console command (under symfony v2.1.7). > They work perfectly fine when the operation happens in a web contoller. > > Is it possible doctrine events are not registered for console commands ? > > It looks like events are generally not bound for console commands: is > https://github.com/symfony/symfony/issues/1929 > There even is a pull request, but it doesn't look like this is going to get > merged into a production branch any time soon: > https://github.com/symfony/symfony/pull/3889 > > I need those events e.g. to set some defaults for associated entities and > queue external processes. I've thought about doing moving the command code > into a web controller but some of the use cases are batch processing where we > require longer runtime and more memour than on the web frontend. > > How can I register the doctrine event manager for commands ? > > > -- > -- > If you want to report a vulnerability issue on Symfony, please read the > procedure on http://symfony.com/security > > You received this message because you are subscribed to the Google > Groups "symfony developers" group. > To post to this group, send email to symfony-devs@googlegroups.com > To unsubscribe from this group, send email to > symfony-devs+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/symfony-devs?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Symfony developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to symfony-devs+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > -- -- If you want to report a vulnerability issue on Symfony, please read the procedure on http://symfony.com/security You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to symfony-devs@googlegroups.com To unsubscribe from this group, send email to symfony-devs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en --- You received this message because you are subscribed to the Google Groups "Symfony developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to symfony-devs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.