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


PHP HttpKernelInterface::getContainer方法代码示例

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


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

示例1: createClient

 /**
  * Creates a Client.
  *
  * @param array $options An array of options to pass to the createKernel class
  * @param array $server  An array of server parameters
  * @param array $cookies An array of Symfony\Component\BrowserKit\Cookie
  *
  * @return Client A Client instance
  */
 public function createClient(array $options = array(), array $server = array(), array $cookies = array())
 {
     if (null !== $this->kernel && $this->kernelReset) {
         $this->kernel->shutdown();
         $this->kernel->boot();
     }
     if (null === $this->kernel) {
         $this->kernel = $this->createKernel($options);
         $this->kernel->boot();
     }
     $client = $this->kernel->getContainer()->get('test.client');
     $client->setServerParameters($server);
     foreach ($cookies as $cookie) {
         $client->getCookieJar()->set($cookie);
     }
     return $client;
 }
开发者ID:SelviA,项目名称:AtoumBundle,代码行数:26,代码来源:WebTestCase.php

示例2: defineCurrency

 protected function defineCurrency(Request $request)
 {
     $currency = null;
     if ($request->query->has("currency")) {
         $currency = CurrencyQuery::create()->findOneByCode($request->query->get("currency"));
         if ($currency) {
             if (false === $this->app->getContainer()->isScopeActive('request')) {
                 $this->app->getContainer()->enterScope('request');
                 $this->app->getContainer()->set('request', $request, 'request');
             }
             $this->eventDispatcher->dispatch(TheliaEvents::CHANGE_DEFAULT_CURRENCY, new CurrencyChangeEvent($currency, $request));
         }
     } else {
         $currency = $request->getSession()->getCurrency(false);
     }
     if (null === $currency) {
         $currency = Currency::getDefaultCurrency();
     }
     return $currency;
 }
开发者ID:NandoKstroNet,项目名称:thelia,代码行数:20,代码来源:ParamInitMiddleware.php

示例3: getContainer

 /**
  * @return mixed
  */
 public function getContainer()
 {
     return static::$kernel->getContainer();
 }
开发者ID:WeavingTheWeb,项目名称:FrameworkExtraBundle,代码行数:7,代码来源:TestCase.php


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