本文整理汇总了PHP中Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand::setContainer方法的典型用法代码示例。如果您正苦于以下问题:PHP ContainerAwareCommand::setContainer方法的具体用法?PHP ContainerAwareCommand::setContainer怎么用?PHP ContainerAwareCommand::setContainer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand
的用法示例。
在下文中一共展示了ContainerAwareCommand::setContainer方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setContainer
/**
* Set the service container, and initialize the command.
*
* @param ContainerInterface $container
*/
public function setContainer(ContainerInterface $container = null)
{
parent::setContainer($container);
$this->templating = $container->get('templating');
$this->logger = $container->get('monolog.logger.processing');
$this->ping = $container->get('ping');
}
示例2: setContainer
/**
* Set the service container, and initialize the command.
*
* @param ContainerInterface $container
*/
public function setContainer(ContainerInterface $container = null)
{
parent::setContainer($container);
$this->templating = $container->get('templating');
$this->logger = $container->get('logger');
$this->em = $container->get('doctrine')->getManager();
}
示例3: setContainer
/**
* {@inheritdoc}
*/
public function setContainer(ContainerInterface $container = null)
{
parent::setContainer($container);
$this->logger = $container->get('logger');
$this->em = $container->get('doctrine')->getManager();
$this->filePaths = $container->get('filepaths');
}
示例4: setContainer
/**
* Set the service container, and initialize the command.
*
* @param ContainerInterface $container
*/
public function setContainer(ContainerInterface $container = null)
{
parent::setContainer($container);
$this->logger = $container->get('monolog.logger.processing');
$this->em = $container->get('doctrine')->getManager();
$this->filePaths = $container->get('filepaths');
$this->swordClient = $container->get('sword_client');
$this->fs = new Filesystem();
}
示例5: setContainer
public function setContainer(ContainerInterface $container = NULL)
{
parent::setContainer($container);
//Set up some shortcuts to services
if ($container !== NULL) {
$this->_em = $container->get("doctrine.orm.entity_manager");
$this->resultRepo = $this->_em->getRepository("OverwatchResultBundle:TestResult");
}
}
示例6: executeCommand
/**
* Executes specified command.
*
* @param ContainerAwareCommand $commandInstance
* @param string $commandNamespace
* @param array $parameters
*
* @return CommandTester
*/
protected function executeCommand(ContainerAwareCommand $commandInstance, $commandNamespace, array $parameters = [])
{
$application = new Application(self::createClient()->getKernel());
$commandInstance->setContainer($this->getServiceContainer());
$application->add($commandInstance);
$command = $application->find($commandNamespace);
$commandTester = new CommandTester($command);
$commandTester->execute(array_merge_recursive(['command' => $command->getName()], $parameters));
return $commandTester;
}
示例7: setContainer
/**
* Set the service container, and initialize the command.
*
* @param ContainerInterface $container
*/
public function setContainer(ContainerInterface $container = null)
{
parent::setContainer($container);
$this->logger = $container->get('monolog.logger.processing');
$this->em = $container->get('doctrine')->getManager();
}
示例8:
/**
* @param string $command
* @param string $controller
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container
*/
function __construct($command, $controller, ContainerInterface $container)
{
$this->command = new $command();
$this->command->setContainer($container);
$this->controller = $controller;
}
示例9: setContainer
/**
* {@inheritdoc}
*
* @InjectParams({
* "container" = @Inject("service_container")
* })
*/
public function setContainer(ContainerInterface $container = null)
{
parent::setContainer($container);
}
示例10: runCommand
/**
* Runs a command and returns a response if there was an error.
*
* @param ContainerAwareCommand $command
* @param InputInterface|null $input
*
* @return Response|null
*/
private function runCommand(ContainerAwareCommand $command, InputInterface $input = null)
{
if (null === $input) {
$input = new ArgvInput([]);
}
$output = new BufferedOutput(OutputInterface::VERBOSITY_NORMAL, true);
$command->setContainer($this->container);
$status = $command->run($input, $output);
if ($status > 0) {
return $this->render('console.html.twig', ['output' => $output->fetch()]);
}
return null;
}
示例11: setContainer
/**
* @param ContainerInterface|null $container
*/
public function setContainer(ContainerInterface $container = null)
{
parent::setContainer($container);
$this->_consulBag = $container->get('consul_api.bag');
}