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


PHP Application::getHelperSet方法代码示例

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


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

示例1: setApplicationDocumentManager

 public static function setApplicationDocumentManager(Application $application, $dmName)
 {
     $service = null === $dmName ? 'doctrine_phpcr.odm.document_manager' : 'doctrine_phpcr.odm.' . $dmName . '_document_manager';
     $documentManager = $application->getKernel()->getContainer()->get($service);
     $helperSet = $application->getHelperSet();
     $helperSet->set(new DocumentManagerHelper(null, $documentManager));
 }
开发者ID:rejsmont,项目名称:DoctrinePHPCRBundle,代码行数:7,代码来源:DoctrineCommandHelper.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: setApplicationEntityManager

 /**
  * Convenience method to push the helper sets of a given entity manager into the application.
  *
  * @param Application $application
  * @param string      $emName
  */
 public static function setApplicationEntityManager(Application $application, $emName)
 {
     /** @var $em \Doctrine\ORM\EntityManager */
     $em = $application->getHelperSet()->get('container')->getContainer()->get('doctrine')->getManager();
     $helperSet = $application->getHelperSet();
     $helperSet->set(new ConnectionHelper($em->getConnection()), 'db');
     $helperSet->set(new EntityManagerHelper($em), 'em');
 }
开发者ID:inisire,项目名称:framework,代码行数:14,代码来源:DoctrineCommandHelper.php

示例4: testValidHelpers

 public function testValidHelpers()
 {
     $helperSet = $this->cli->getHelperSet();
     /* @var $dmHelper \Doctrine\ODM\MongoDB\Tools\Console\Helper\DocumentManagerHelper */
     $dmHelper = $helperSet->get('dm');
     $this->assertInstanceOf('\\Doctrine\\ODM\\MongoDB\\Tools\\Console\\Helper\\DocumentManagerHelper', $dmHelper);
     $this->assertSame($this->entityManager, $dmHelper->getDocumentManager());
 }
开发者ID:EngrHaiderAli,项目名称:movein-servie,代码行数:8,代码来源:CliTest.php

示例5: getCommandTester

 /**
  * @return CommandTester
  */
 protected function getCommandTester()
 {
     $this->application->getHelperSet()->set($this->dialog, 'dialog');
     $this->application->add($this->command);
     $command = $this->application->find('phpci:create-admin');
     $commandTester = new CommandTester($command);
     return $commandTester;
 }
开发者ID:stefanius,项目名称:phpci-box,代码行数:11,代码来源:CreateAdminCommandTest.php

示例6: getInstance

 /**
  * Create CLI instance.
  *
  * @return Application
  */
 public static function getInstance()
 {
     $questionHelper = new QuestionHelper();
     $application = new Application('CloverToHtml Command Line Interface', 'Beta 0.1.0');
     $application->getHelperSet()->set(new FormatterHelper(), 'formatter');
     $application->getHelperSet()->set($questionHelper, 'question');
     $application->add(ConvertCommandFactory::getInstance());
     return $application;
 }
开发者ID:fezfez,项目名称:coverage-clover-viewer,代码行数:14,代码来源:CliFactory.php

示例7: run

 /**
  * @param string $input
  *
  * @return integer
  */
 public function run($input)
 {
     $this->input = new StringInput($input);
     $this->output = new StreamOutput(fopen('php://memory', 'w', false));
     $inputStream = $this->getInputStream();
     rewind($inputStream);
     $this->application->getHelperSet()->get('dialog')->setInputStream($inputStream);
     $this->result = $this->application->run($this->input, $this->output);
 }
开发者ID:coduo,项目名称:phpspec-matcher-extension,代码行数:14,代码来源:ApplicationTester.php

示例8: getInstance

 /**
  * Create CLI instance.
  *
  * @return \Symfony\Component\Console\Application
  */
 public static function getInstance()
 {
     $questionHelper = new QuestionHelper();
     $application = new Application('Code Generator Command Line Interface', 'Alpha');
     $application->getHelperSet()->set(new FormatterHelper(), 'formatter');
     $application->getHelperSet()->set($questionHelper, 'question');
     $application->add(new ConvertDirectory());
     return $application;
 }
开发者ID:noikiy,项目名称:php-to-zephir,代码行数:14,代码来源:CliFactory.php

示例9: getInstance

 /**
  * Create CLI instance.
  *
  * @return Application
  */
 public static function getInstance(OutputInterface $output)
 {
     $questionHelper = new QuestionHelper();
     $application = new Application('PHP to Zephir Command Line Interface', 'Beta 0.2.0');
     $application->getHelperSet()->set(new FormatterHelper(), 'formatter');
     $application->getHelperSet()->set($questionHelper, 'question');
     $application->add(ConvertFactory::getInstance($output));
     return $application;
 }
开发者ID:surjit,项目名称:php-to-zephir,代码行数:14,代码来源:CliFactory.php

示例10: testValidHelpers

 public function testValidHelpers()
 {
     $helperSet = $this->cli->getHelperSet();
     /* @var $emHelper \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper */
     $emHelper = $helperSet->get('em');
     $this->assertInstanceOf('Doctrine\\ORM\\Tools\\Console\\Helper\\EntityManagerHelper', $emHelper);
     $this->assertSame($this->entityManager, $emHelper->getEntityManager());
     /* @var $dbHelper \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper */
     $dbHelper = $helperSet->get('db');
     $this->assertInstanceOf('Doctrine\\DBAL\\Tools\\Console\\Helper\\ConnectionHelper', $dbHelper);
     $this->assertSame($this->entityManager->getConnection(), $dbHelper->getConnection());
 }
开发者ID:eltondias,项目名称:Relogio,代码行数:12,代码来源:CliTest.php

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

示例12: setApplicationConnection

 public static function setApplicationConnection(Application $application, $connName)
 {
     $app = $application->getApp();
     $connection = $app['db'];
     $helperSet = $application->getHelperSet();
     $helperSet->set(new ConnectionHelper($connection), 'db');
 }
开发者ID:digitas,项目名称:digex-core,代码行数:7,代码来源:DoctrineCommandHelper.php

示例13:

 function it_should_wrap_getApplication_in_a_shell(Application $app, HelperSet $helperSet)
 {
     $app->getHelperSet()->willReturn($helperSet);
     $app->getName()->willReturn('test');
     $this->setApplication($app);
     $shell = $this->getShell();
     $shell->shouldHaveType('Symfony\\Component\\Console\\Shell');
 }
开发者ID:niden,项目名称:task,代码行数:8,代码来源:ShellCommandSpec.php

示例14: initHelper

 /**
  * @param Application $application
  * @param mixed $default
  * @param array $options
  * @return ConfigurationHelper
  */
 public static function initHelper(Application $application, $default = null, array $options = [])
 {
     $options = $options + ['name' => 'config', 'abbreviation' => 'c', 'description' => 'Path to the configuration file.', 'filename' => 'cli-config.php'];
     $helper = new static($options['name'], $options['filename']);
     $helper->setDefault($default);
     $application->getDefinition()->addOption(new InputOption($options['name'], $options['abbreviation'], InputOption::VALUE_REQUIRED, $options['description']));
     $application->getHelperSet()->set($helper);
     return $helper;
 }
开发者ID:phlib,项目名称:console-configuration,代码行数:15,代码来源:ConfigurationHelper.php

示例15: setApplication

 /**
  * Sets the application instance for this command.
  *
  * @param Application $application An Application instance
  *
  * @api
  */
 public function setApplication(Application $application = null)
 {
     $this->application = $application;
     if ($application) {
         $this->setHelperSet($application->getHelperSet());
     } else {
         $this->helperSet = null;
     }
 }
开发者ID:laiello,项目名称:masfletes,代码行数:16,代码来源:Command.php


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