/** * @param AppInterface $app */ public function __construct(AppInterface $app) { $this->app = $app; parent::__construct('PPI', $app->getVersion() . ' - ' . $app->getEnvironment() . ($app->isDebug() ? '/debug' : '')); $this->getDefinition()->addOption(new InputOption('--shell', '-s', InputOption::VALUE_NONE, 'Launch the shell.')); $this->getDefinition()->addOption(new InputOption('--process-isolation', null, InputOption::VALUE_NONE, 'Launch commands from shell as a separate process.')); $this->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', $app->getEnvironment())); $this->getDefinition()->addOption(new InputOption('--no-debug', null, InputOption::VALUE_NONE, 'Switches off debug mode.')); }
protected function registerCommands() { $this->app->boot(); $config = $this->app->getConfig(); $commands = array(new Command\AssetsInstallCommand(), new Command\CacheClearCommand(), new Command\ConfigDebugCommand(), new Command\ModuleDebugCommand(), new Command\RouterDebugCommand(), new Command\RouterMatchCommand(), new Command\ServiceManagerDebugCommand()); if (isset($config['modules']['module_listener_options']['module_paths'][0], $config['framework']['skeleton_module']['path'])) { $moduleCreateCommand = new Command\ModuleCreateCommand(); $moduleCreateCommand->setTargetModuleDir($config['modules']['module_listener_options']['module_paths'][0]); $moduleCreateCommand->setSkeletonModuleDir($config['framework']['skeleton_module']['path']); $commands[] = $moduleCreateCommand; } $this->addCommands($commands); // Commands found in active Modules foreach ($this->app->getModules() as $module) { if ($module instanceof AbstractModule) { $module->registerCommands($this); } } }