Symfony\Bundle\FrameworkBundle\Console\Application::registerCommands PHP Méthode

registerCommands() protected méthode

protected registerCommands ( )
    protected function registerCommands()
    {
        if ($this->commandsRegistered) {
            return;
        }
        $this->commandsRegistered = true;
        $this->kernel->boot();
        $container = $this->kernel->getContainer();
        foreach ($this->kernel->getBundles() as $bundle) {
            if ($bundle instanceof Bundle) {
                $bundle->registerCommands($this);
            }
        }
        if ($container->hasParameter('console.command.ids')) {
            foreach ($container->getParameter('console.command.ids') as $id) {
                $this->add($container->get($id));
            }
        }
    }

Usage Example

 protected function registerCommands()
 {
     parent::registerCommands();
     $container = $this->getKernel()->getContainer();
     $siteAccess = $container->get('ezpublish.siteaccess');
     $siteAccess->name = $this->siteAccessName ?: $container->getParameter('ezpublish.siteaccess.default');
     $siteAccess->matchingType = 'cli';
 }
All Usage Examples Of Symfony\Bundle\FrameworkBundle\Console\Application::registerCommands