本文整理汇总了PHP中Symfony\Bundle\FrameworkBundle\Console\Application::getHelperSet方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::getHelperSet方法的具体用法?PHP Application::getHelperSet怎么用?PHP Application::getHelperSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Bundle\FrameworkBundle\Console\Application
的用法示例。
在下文中一共展示了Application::getHelperSet方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* @param array $input
*
* @return integer
*/
public function run($input = array())
{
$this->input = new ArrayInput((array) $input);
$this->input->setInteractive(false);
$this->output = new StreamOutput(fopen('php://memory', 'r+', false));
$inputStream = $this->getInputStream();
rewind($inputStream);
$this->application->getHelperSet()->get('dialog')->setInputStream($inputStream);
return $this->application->doRun($this->input, $this->output);
}
示例2: addConsoleHelpers
private function addConsoleHelpers(FrameworkApplication $app)
{
if (!Util::hasQuestionHelper()) {
$helper = $app->getKernel()->getContainer()->get('rj_frontend.console.helper.question_legacy');
$app->getHelperSet()->set($helper, 'question');
}
}
示例3: setApplicationDocumentManager
/**
* @param Symfony\Bundle\FrameworkBundle\Console\Application
* @param string $dmName
*/
public static function setApplicationDocumentManager(Application $application, $dmName)
{
/** @var $dm \Doctrine\ODM\DocumentManager */
$alias = sprintf("doctrine_mongodb.odm.%s", $dmName);
$dm = $application->getKernel()->getContainer()->get($alias);
$helperSet = $application->getHelperSet();
$helperSet->set(new DocumentManagerHelper($dm), 'dm');
}
示例4: setApplicationDocumentManager
/**
* Set the document manager on the application.
*
* @param Application $application
* @param string $dmName
*/
public static function setApplicationDocumentManager(Application $application, $dmName)
{
/** @var $registry ManagerRegistry */
$registry = $application->getKernel()->getContainer()->get('doctrine_phpcr');
$documentManager = $registry->getManager($dmName);
$helperSet = $application->getHelperSet();
$helperSet->set(new DocumentManagerHelper(null, $documentManager));
}
示例5: setApplicationDocumentManager
public static function setApplicationDocumentManager(Application $application, $dmName)
{
$container = $application->getKernel()->getContainer();
$dmName = $dmName ? $dmName : 'default';
$dmServiceName = sprintf('doctrine.odm.mongodb.%s_document_manager', $dmName);
if (!$container->has($dmServiceName)) {
throw new \InvalidArgumentException(sprintf('Could not find Doctrine ODM DocumentManager named "%s"', $dmName));
}
$dm = $container->get($dmServiceName);
$helperSet = $application->getHelperSet();
$helperSet->set(new DocumentManagerHelper($dm), 'dm');
}
示例6: setApplicationConnection
public static function setApplicationConnection(Application $application, $connName)
{
$container = $application->getKernel()->getContainer();
$connName = $connName ? $connName : $container->getParameter('doctrine.dbal.default_connection');
$connServiceName = sprintf('doctrine.dbal.%s_connection', $connName);
if (!$container->has($connServiceName)) {
throw new \InvalidArgumentException(sprintf('Could not find Doctrine Connection named "%s"', $connName));
}
$connection = $container->get($connServiceName);
$helperSet = $application->getHelperSet();
$helperSet->set(new ConnectionHelper($connection), 'db');
}
示例7: setApplicationXmlEntityManager
public static function setApplicationXmlEntityManager(Application $application, $xemName)
{
$container = $application->getKernel()->getContainer();
$xemName = $xemName ? $xemName : 'default';
$xemServiceName = sprintf('doctrine.oxm.%s_xml_entity_manager', $xemName);
if (!$container->has($xemServiceName)) {
throw new \InvalidArgumentException(sprintf('Could not find Doctrine OXM XmlEntityManager named "%s"', $xemName));
}
$xem = $container->get($xemServiceName);
$helperSet = $application->getHelperSet();
$helperSet->set(new XmlEntityManagerHelper($xem), 'xem');
}
示例8: testCommand
/**
* @dataProvider provideTestCommand
*
* @param $command
* @param $reportFile
*/
public function testCommand($command, $arguments, $reportFile, $inputStream = null)
{
$client = static::createClient();
$application = new Application($client->getKernel());
$application->setCatchExceptions(false);
$output = new BufferedOutput();
$application->setAutoExit(false);
if ($inputStream) {
$application->getHelperSet()->get('dialog')->setInputStream($this->getInputStream($inputStream));
}
//We push a empty argument that is ignore by the application and we push the command itself
array_unshift($arguments, null, $command);
$application->run(new ArgvInput($arguments), $output);
if ($this->dev) {
file_put_contents($reportFile, $this->report($application));
}
$this->assertStringEqualsFile($reportFile, $this->report($application));
}
示例9: setApplicationConnection
/**
* Convenience method to push the helper sets of a given connection into the application.
*
* @param Application $application
* @param string $connName
*/
public static function setApplicationConnection(Application $application, $connName)
{
$connection = $application->getKernel()->getContainer()->get('doctrine')->getConnection($connName);
$helperSet = $application->getHelperSet();
$helperSet->set(new ConnectionHelper($connection), 'db');
}
示例10: setApplicationDocumentManager
public static function setApplicationDocumentManager(Application $application, $dmName)
{
$dm = $application->getKernel()->getContainer()->get('doctrine_mongodb')->getManager($dmName);
$helperSet = $application->getHelperSet();
$helperSet->set(new DocumentManagerHelper($dm), 'dm');
}