N98\Magento\Application::add PHP Method

add() public method

Override standard command registration. We want alias support.
public add ( Command $command ) : Command
$command Symfony\Component\Console\Command\Command
return Symfony\Component\Console\Command\Command
    public function add(Command $command)
    {
        if ($this->config) {
            $this->config->registerConfigCommandAlias($command);
        }
        return parent::add($command);
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * @param Application $application
  */
 public function registerCustomCommands(Application $application)
 {
     foreach ($this->getArray(array('commands', 'customCommands')) as $commandClass) {
         $commandName = null;
         if (is_array($commandClass)) {
             // Support for key => value (name -> class)
             $commandName = key($commandClass);
             $commandClass = current($commandClass);
         }
         if (null === ($command = $this->newCommand($commandClass, $commandName))) {
             $this->output->writeln(sprintf('<error>Can not add nonexistent command class "%s" as command to the application</error>', $commandClass, $commandName));
             $this->debugWriteln('Please check the configuration files contain the correct class-name. If the ' . 'class-name is correct, check autoloader configurations.');
         } else {
             $this->debugWriteln(sprintf('<debug>Add command </debug> <info>%s</info> -> <comment>%s</comment>', $command->getName(), get_class($command)));
             $application->add($command);
         }
     }
 }
All Usage Examples Of N98\Magento\Application::add