当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::addCommands方法代码示例

本文整理汇总了PHP中Symfony\Component\Console\Application::addCommands方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::addCommands方法的具体用法?PHP Application::addCommands怎么用?PHP Application::addCommands使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Console\Application的用法示例。


在下文中一共展示了Application::addCommands方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setConsole

 /**
  * Config doctrine console
  *
  * @param Application $console
  * @param EntityManager $entityManager
  * @return Application
  */
 static function setConsole(Application $console, EntityManager $entityManager)
 {
     $helperSet = new \Symfony\Component\Console\Helper\HelperSet(array('db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($entityManager->getConnection()), 'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($entityManager)));
     $console->setHelperSet($helperSet);
     $console->addCommands(array(new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(), new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand(), new \Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand(), new \Doctrine\ORM\Tools\Console\Command\ConvertDoctrine1SchemaCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateEntitiesCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand(), new \Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand(), new \Doctrine\ORM\Tools\Console\Command\RunDqlCommand(), new \Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand()));
     return $console;
 }
开发者ID:RamEduard,项目名称:rameduard.github.io,代码行数:14,代码来源:ConfigConsole.php

示例2: __construct

 /**
  * Services constructor.
  */
 public function __construct()
 {
     $this->kernel = new Kernel();
     $this->application = new Application('Neusta Facilior', FACILIOR_VERSION);
     $this->application->setAutoExit(false);
     //Creates Services Output
     $this->console = new ConsoleService();
     //Loads Commands into Application
     $this->application->addCommands($this->kernel->commands());
 }
开发者ID:lotzer,项目名称:facilior,代码行数:13,代码来源:Console.php

示例3: main

 /**
  * command应用主入口
  * @throws \Exception
  */
 static function main()
 {
     $application = new Application();
     $application->addCommands(self::createCommands());
     $application->setDefaultCommand(self::DEFAULT_COMMAND_NAME);
     $application->run();
 }
开发者ID:slince,项目名称:runner,代码行数:11,代码来源:CommandUI.php

示例4: main

 /**
  * command应用主入口
  * @throws \Exception
  */
 static function main()
 {
     $application = new Application();
     $application->addCommands(self::createCommands());
     $application->setDefaultCommand(ThumbnailCommand::COMMAND_NAME);
     $application->run();
 }
开发者ID:slince,项目名称:magic-hand,代码行数:11,代码来源:CommandUI.php

示例5: run

 /**
  * Inicializa a aplicação.
  *
  * @throws \Exception
  */
 public function run()
 {
     //apenas para inicializar
     Config::getInstance();
     $application = new Application();
     $commands = [];
     /* Carregando os comandos internos */
     $anna_commands = __DIR__ . DS . 'Commands' . DS;
     $anna_commands = $this->loadAppCommands($anna_commands);
     /* Carregandos os comandos criados pelos desenvolvedores */
     $app_commands = SYS_ROOT . 'App' . DS . 'Console' . DS;
     $app_commands = $this->loadAppCommands($app_commands);
     /* Registra todos os comandos encontrados */
     foreach ($app_commands as $cmd) {
         $commands[] = new $cmd();
     }
     foreach ($anna_commands as $cmd) {
         $class = new \ReflectionClass($cmd);
         if (!$class->isAbstract()) {
             $commands[] = new $cmd();
         }
     }
     $application->addCommands($commands);
     $application->run();
 }
开发者ID:anna-framework,项目名称:anna,代码行数:30,代码来源:Initializer.php

示例6: addCommands

 /**
  * @param Application $cli
  *
  * @return void
  */
 public static function addCommands(Application $cli)
 {
     $cli->addCommands([new Command\ExecuteCommand(), new Command\GenerateCommand(), new Command\LatestCommand(), new Command\MigrateCommand(), new Command\StatusCommand(), new Command\VersionCommand(), new Command\UpToDateCommand()]);
     if ($cli->getHelperSet()->has('em')) {
         $cli->add(new Command\DiffCommand());
     }
 }
开发者ID:doctrine,项目名称:migrations,代码行数:12,代码来源:ConsoleRunner.php

示例7: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     $this->application = new Application('Drupal Code Generator', '@git-version@');
     $discovery = new GeneratorDiscovery([DCG_ROOT . '/src/Commands'], [DCG_ROOT . '/src/Templates'], new Filesystem());
     $generators = $discovery->getGenerators();
     $this->application->addCommands($generators);
     $navigation = new Navigation();
     $navigation->init($generators);
     $this->application->add($navigation);
     $this->command = $this->application->find('navigation');
     $this->questionHelper = $this->createMock('Symfony\\Component\\Console\\Helper\\QuestionHelper');
     $this->helperSet = $this->command->getHelperSet();
     $this->commandTester = new CommandTester($this->command);
     $this->filesystem = new Filesystem();
     $this->destination = DCG_SANDBOX . '/tests';
 }
开发者ID:chi-teck,项目名称:drupal-code-generator,代码行数:19,代码来源:IntegrationTest.php

示例8: main

 /**
  * command应用主入口
  * @throws \Exception
  */
 static function main()
 {
     $application = new Application();
     $application->setAutoExit(true);
     $application->addCommands(self::createCommands());
     $application->run();
 }
开发者ID:slince,项目名称:mechanic,代码行数:11,代码来源:CommandUI.php

示例9: createConsole

 /**
  * Creates console.
  *
  * @param HelperSet $helperSet
  * @param \Symfony\Component\Console\Command\Command[] $commands
  * @return Application
  */
 public function createConsole(HelperSet $helperSet, array $commands)
 {
     $cli = new Application($this->getName(), $this->getVersion());
     $cli->setCatchExceptions(true);
     $cli->setHelperSet($helperSet);
     $cli->addCommands($commands);
     return $cli;
 }
开发者ID:raphhh,项目名称:pinguin,代码行数:15,代码来源:ConsoleHelper.php

示例10: boot

 /**
  * @param CoreInterface $core
  */
 protected function boot(CoreInterface $core)
 {
     $config = $core->make('Surume\\Config\\ConfigInterface');
     $factory = $core->make('Surume\\Console\\Client\\Command\\CommandFactoryInterface');
     $handler = $core->make('Surume\\Console\\Client\\Command\\CommandHandlerInterface');
     $console = $core->make('Surume\\Console\\Client\\ConsoleClientInterface');
     $cmds = (array) $factory->getDefinitions();
     $commands = [];
     foreach ($cmds as $command => $definition) {
         $commands[] = $factory->create($command, [$handler]);
     }
     $this->symfony->addCommands($commands);
     $version = $core->version();
     $console->onCommand(function () use($version) {
         echo "SurumePHP-v{$version}\n";
         $this->symfony->run();
     });
 }
开发者ID:khelle,项目名称:surume,代码行数:21,代码来源:SymfonyProvider.php

示例11: addCommands

 /**
  * @param CommandLoader $commandLoader
  * @param $locations
  */
 private function addCommands(CommandLoader $commandLoader, $locations, $bypassCache = false)
 {
     $classes = $this->classCache->getClasses('RoboCommand\\', $locations, $bypassCache);
     $commands = $commandLoader->createRoboCommands($classes, $this->passThroughArgs);
     $this->app->addCommands($commands);
     $classes = $this->classCache->getClasses('Command\\', $locations, $bypassCache);
     $commands = $commandLoader->createSymfonyCommands($classes);
     $this->app->addCommands($commands);
 }
开发者ID:twhiston,项目名称:tg,代码行数:13,代码来源:Tg.php

示例12: run

 /**
  * Runs console with the given helperset.
  *
  * @param \Symfony\Component\Console\Helper\HelperSet  $helperSet
  * @param \Symfony\Component\Console\Command\Command[] $commands
  *
  * @return void
  */
 public static function run(HelperSet $helperSet, $commands = array(), OutputInterface $output = null)
 {
     $cli = new Application('Doctrine Command Line Interface', Version::VERSION);
     $cli->setCatchExceptions(true);
     $cli->setHelperSet($helperSet);
     $cli->setAutoExit(false);
     $commands = array_merge(self::getDefaultCommands(), $commands);
     $cli->addCommands($commands);
     $cli->run(null, $output);
 }
开发者ID:useallfive,项目名称:doctrine-web-console,代码行数:18,代码来源:ConsoleRunner.php

示例13: provideApp

 /** @Provides("Symfony\Component\Console\Application") @Singleton */
 static function provideApp($name = "UNKNOWN", $version = "UNKNOWN", $helpers = [], $commands = [])
 {
     $app = new Application($name, $version);
     $app->addCommands($commands);
     $helperSet = $app->getHelperSet();
     foreach ($helpers as $alias => $helper) {
         $helperSet->set($helper, $alias);
     }
     return $app;
 }
开发者ID:spotframework,项目名称:spot,代码行数:11,代码来源:SymfonyConsoleModule.php

示例14: testAdd

 public function testAdd()
 {
     $application = new Application();
     $application->add($foo = new \FooCommand());
     $commands = $application->all();
     $this->assertEquals($foo, $commands['foo:bar'], '->add() registers a command');
     $application = new Application();
     $application->addCommands(array($foo = new \FooCommand(), $foo1 = new \Foo1Command()));
     $commands = $application->all();
     $this->assertEquals(array($foo, $foo1), array($commands['foo:bar'], $commands['foo:bar1']), '->addCommands() registers an array of commands');
 }
开发者ID:spf13,项目名称:symfony,代码行数:11,代码来源:ApplicationTest.php

示例15: createService

 /**
  * Sets the dojo theme to use.
  *
  * @param \Zend\ServiceManager\ServiceLocatorInterface $serviceLocator
  * @return \Symfony\Component\Console\Application
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $config = $serviceLocator->get('Config')['sds']['dojo'];
     $configHelper = new \Sds\DojoModule\Tools\Console\Helper\ConfigHelper($config);
     $helperSet = new HelperSet();
     $helperSet->set($configHelper, 'config');
     $cli = new Application();
     $cli->setName('DojoModule Command Line Interface');
     $cli->setHelperSet($helperSet);
     $cli->addCommands(array(new \Sds\DojoModule\Tools\Console\Command\GenerateProfile()));
     return $cli;
 }
开发者ID:ronald132,项目名称:dojoModule,代码行数:18,代码来源:CliFactory.php


注:本文中的Symfony\Component\Console\Application::addCommands方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。