當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。