registerEventCommands example

            // so that non-db commands can still execute             try {
                $em = $this->kernel->getContainer()->get(ModelManager::class);

                // Setup doctrine commands                 $helperSet = $this->getHelperSet();
                $helperSet->set(new EntityManagerHelper($em), 'em');
                $helperSet->set(new ConnectionHelper($em->getConnection()), 'db');

                DoctrineConsoleRunner::addCommands($this);

                $this->registerEventCommands();

                foreach ($this->kernel->getPlugins() as $plugin) {
                    if ($plugin->isActive()) {
                        $plugin->registerCommands($this);
                    }
                }
            } catch (Exception $e) {
                $formatter = $this->getHelperSet()->get('formatter');
                $output->writeln($formatter->formatBlock('WARNING! ' . $e->getMessage() . ' in ' . $e->getFile(), 'error'));
            }
        }
    }
Home | Imprint | This part of the site doesn't use cookies.