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


PHP Application::setHelperSet方法代码示例

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


在下文中一共展示了Application::setHelperSet方法的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: boot

 /**
  * Bootstraps the application.
  *
  * This method is called after all services are registered
  * and should be used for "dynamic" configuration (whenever
  * a service must be requested).
  *
  * @param Application $app
  */
 public function boot(Application $app)
 {
     $helperSet = new HelperSet(array('connection' => new ConnectionHelper($app['db']), 'dialog' => new DialogHelper()));
     if (isset($app['orm.em'])) {
         $helperSet->set(new EntityManagerHelper($app['orm.em']), 'em');
     }
     $this->console->setHelperSet($helperSet);
     $commands = array('Doctrine\\DBAL\\Migrations\\Tools\\Console\\Command\\ExecuteCommand', 'Doctrine\\DBAL\\Migrations\\Tools\\Console\\Command\\GenerateCommand', 'Doctrine\\DBAL\\Migrations\\Tools\\Console\\Command\\MigrateCommand', 'Doctrine\\DBAL\\Migrations\\Tools\\Console\\Command\\StatusCommand', 'Doctrine\\DBAL\\Migrations\\Tools\\Console\\Command\\VersionCommand');
     // @codeCoverageIgnoreStart
     if (true === $this->console->getHelperSet()->has('em')) {
         $commands[] = 'Doctrine\\DBAL\\Migrations\\Tools\\Console\\Command\\DiffCommand';
     }
     // @codeCoverageIgnoreEnd
     $configuration = new Configuration($app['db'], $app['migrations.output_writer']);
     $configuration->setMigrationsDirectory($app['migrations.directory']);
     $configuration->setName($app['migrations.name']);
     $configuration->setMigrationsNamespace($app['migrations.namespace']);
     $configuration->setMigrationsTableName($app['migrations.table_name']);
     $configuration->registerMigrationsFromDirectory($app['migrations.directory']);
     foreach ($commands as $name) {
         /** @var AbstractCommand $command */
         $command = new $name();
         $command->setMigrationConfiguration($configuration);
         $this->console->add($command);
     }
 }
开发者ID:Leemo,项目名称:silex-doctrine-migrations-provider,代码行数:35,代码来源:DoctrineMigrationsProvider.php

示例3: setUp

 protected function setUp()
 {
     $this->enableSecondLevelCache();
     parent::setUp();
     $this->application = new Application();
     $this->command = new CollectionRegionCommand();
     $this->application->setHelperSet(new HelperSet(array('em' => new EntityManagerHelper($this->_em))));
     $this->application->add($this->command);
 }
开发者ID:selimcr,项目名称:servigases,代码行数:9,代码来源:ClearCacheCollectionRegionCommandTest.php

示例4: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->application = new Application();
     $command = new InfoCommand();
     $this->application->setHelperSet(new HelperSet(array('em' => new EntityManagerHelper($this->_em))));
     $this->application->add($command);
     $this->command = $this->application->find('orm:info');
     $this->tester = new CommandTester($command);
 }
开发者ID:selimcr,项目名称:servigases,代码行数:10,代码来源:InfoCommandTest.php

示例5: setUp

 protected function setUp()
 {
     $this->useModelSet('generic');
     parent::setUp();
     $this->application = new Application();
     $this->command = new RunDqlCommand();
     $this->application->setHelperSet(new HelperSet(array('em' => new EntityManagerHelper($this->_em))));
     $this->application->add($this->command);
     $this->tester = new CommandTester($this->command);
 }
开发者ID:selimcr,项目名称:servigases,代码行数:10,代码来源:RunDqlCommandTest.php

示例6: setUp

 public function setUp()
 {
     $this->connection = $this->getMockBuilder('Doctrine\\DBAL\\Connection')->disableOriginalConstructor()->getMock();
     $this->platform = $this->getMockBuilder('Doctrine\\DBAL\\Platforms\\MySqlPlatform')->disableOriginalConstructor()->getMock();
     $this->connection->expects($this->any())->method('getDatabasePlatform')->will($this->returnValue($this->platform));
     $this->helperSet = new HelperSet(array('phpcr' => new DoctrineDbalHelper($this->connection)));
     $this->application = new Application();
     $this->application->setHelperSet($this->helperSet);
     $command = new InitDoctrineDbalCommand();
     $this->application->add($command);
 }
开发者ID:wachterjohannes,项目名称:jackalope-doctrine-dbal,代码行数:11,代码来源:InitDoctrineDbalCommandTest.php

示例7: ormCommands

 /**
  * @param $orm
  */
 public function ormCommands($orm)
 {
     if (is_array($orm) && in_array('doctrine', $orm)) {
         /** @var EntityManager $em */
         $em = Model::orm('doctrine')->getOrm();
         $helperSet = ConsoleRunner::createHelperSet($em);
         $this->cli->setCatchExceptions(true);
         $this->cli->setHelperSet($helperSet);
         ConsoleRunner::addCommands($this->cli);
     }
 }
开发者ID:jetfirephp,项目名称:framework,代码行数:14,代码来源:ConsoleProvider.php

示例8: setUp

 /**
  * @inheritdoc
  */
 protected function setUp()
 {
     parent::setUp();
     $this->path = \sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid('doctrine_');
     \mkdir($this->path);
     $metadataDriver = $this->_em->getConfiguration()->getMetadataDriverImpl();
     $metadataDriver->addPaths(array(__DIR__ . '/../../../../Models/DDC3231/'));
     $this->application = new Application();
     $this->application->setHelperSet(new HelperSet(array('em' => new EntityManagerHelper($this->_em))));
     $this->application->add(new GenerateRepositoriesCommand());
 }
开发者ID:selimcr,项目名称:servigases,代码行数:14,代码来源:GenerateRepositoriesCommandTest.php

示例9: testExecuteWithExectedUnavailableVersionAndInteraction

 public function testExecuteWithExectedUnavailableVersionAndInteraction()
 {
     // Mocks
     $configuration = $this->buildMock('AntiMattr\\MongoDB\\Migrations\\Configuration\\Configuration');
     $executedVersion = $this->buildMock('AntiMattr\\MongoDB\\Migrations\\Version');
     $migration = $this->buildMock('AntiMattr\\MongoDB\\Migrations\\Migration');
     $dialog = $this->buildMock('Symfony\\Component\\Console\\Helper\\DialogHelper');
     // Variables and Objects
     $numVersion = '000123456789';
     $input = new ArgvInput(array('application-name', MigrateCommand::NAME, $numVersion));
     $interactive = true;
     $executedVersions = array($executedVersion);
     $availableVersions = array();
     $application = new Application();
     $helperSet = new HelperSet(array('dialog' => $dialog));
     // Set properties on objects
     $application->setHelperSet($helperSet);
     $this->command->setApplication($application);
     $input->setInteractive($interactive);
     $this->command->setMigration($migration);
     $this->command->setMigrationConfiguration($configuration);
     // Expectations
     $configuration->expects($this->once())->method('getMigratedVersions')->will($this->returnValue($executedVersions));
     $configuration->expects($this->once())->method('getAvailableVersions')->will($this->returnValue($availableVersions));
     $dialog->expects($this->exactly(2))->method('askConfirmation')->will($this->returnValue(true));
     $migration->expects($this->once())->method('migrate')->with($numVersion);
     // Run command, run.
     $this->command->run($input, $this->output);
 }
开发者ID:xtx-dev,项目名称:mongodb-migrations,代码行数:29,代码来源:MigrateCommandTest.php

示例10: getConsole

 /**
  * @return \Symfony\Component\Console\Application
  */
 public function getConsole()
 {
     $application = new Application('psx', Base::getVersion());
     $application->setHelperSet(new HelperSet($this->appendConsoleHelpers()));
     $this->appendConsoleCommands($application);
     return $application;
 }
开发者ID:seytar,项目名称:psx,代码行数:10,代码来源:Console.php

示例11: run

 /**
  * @param HelperSet $helperSet
  * @param array $commands
  */
 public static function run(HelperSet $helperSet, $commands = array())
 {
     $cli = new \Symfony\Component\Console\Application('Malocher EventStore CLI', self::VERSION);
     $cli->setHelperSet($helperSet);
     $cli->setCatchExceptions(true);
     self::addCommands($cli);
     $cli->run();
 }
开发者ID:malocher,项目名称:event-store,代码行数:12,代码来源:ConsoleRunner.php

示例12: run

 /**
  * Run console with the given helperset.
  *
  * @param \Symfony\Component\Console\Helper\HelperSet $helperSet
  * @return void
  */
 public static function run(HelperSet $helperSet)
 {
     $cli = new Application('Propel Command Line Tool', \PropelCli\Version::VERSION);
     $cli->setCatchExceptions(true);
     $cli->setHelperSet($helperSet);
     self::addCommands($cli);
     $cli->run();
 }
开发者ID:chriswoodford,项目名称:propel-cli,代码行数:14,代码来源:ConsoleRunner.php

示例13: 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

示例14: setUp

 public function setUp()
 {
     $this->session = $this->getMock('PHPCR\\SessionInterface');
     $this->workspace = $this->getMock('PHPCR\\WorkspaceInterface');
     $this->repository = $this->getMock('PHPCR\\RepositoryInterface');
     $this->queryManager = $this->getMock('PHPCR\\Query\\QueryManagerInterface');
     $this->row1 = $this->getMock('PHPCR\\Tests\\Stubs\\MockRow');
     $this->node1 = $this->getMock('PHPCR\\Tests\\Stubs\\MockNode');
     $this->dumperHelper = $this->getMockBuilder('PHPCR\\Util\\Console\\Helper\\PhpcrConsoleDumperHelper')->disableOriginalConstructor()->getMock();
     $this->helperSet = new HelperSet(array('phpcr' => new PhpcrHelper($this->session), 'phpcr_console_dumper' => $this->dumperHelper));
     $this->session->expects($this->any())->method('getWorkspace')->will($this->returnValue($this->workspace));
     $this->workspace->expects($this->any())->method('getName')->will($this->returnValue('test'));
     $this->workspace->expects($this->any())->method('getQueryManager')->will($this->returnValue($this->queryManager));
     $this->queryManager->expects($this->any())->method('getSupportedQueryLanguages')->will($this->returnValue(array('JCR-SQL2')));
     $this->application = new Application();
     $this->application->setHelperSet($this->helperSet);
 }
开发者ID:nikophil,项目名称:cmf-tests,代码行数:17,代码来源:BaseCommandTest.php

示例15: run

 /**
  * Run console with the given helperset.
  *
  * @param \Symfony\Component\Console\Helper\HelperSet $helperSet
  * @return void
  */
 public static function run(HelperSet $helperSet)
 {
     $cli = new Application('Doctrine Command Line Interface', \Doctrine\ORM\Version::VERSION);
     $cli->setCatchExceptions(true);
     $cli->setHelperSet($helperSet);
     self::addCommands($cli);
     $cli->run();
 }
开发者ID:pabloasc,项目名称:test_social,代码行数:14,代码来源:ConsoleRunner.php


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