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


PHP AppKernel::getContainer方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     $this->kernel = new \AppKernel('test', true);
     $this->kernel->boot();
     $this->container = $this->kernel->getContainer();
     parent::setUp();
 }
开发者ID:Codixis,项目名称:CSBill,代码行数:7,代码来源:KernelAwareTest.php

示例2: loadSf2

 private function loadSf2()
 {
     global $kernel;
     //@settings_fields('wp_symfony_settings');
     //@do_settings_fields('wp_symfony_settings');
     $path = get_option('symfony2_path');
     $env = get_option('symfony2_env');
     $url = get_option('symfony2_url');
     if (!$this->isValidSymfonyPath($path)) {
         add_action('admin_footer', array($this, 'symfony2_warning'));
         return;
     }
     if ($kernel == null) {
         $loader = (require_once $path . 'app/bootstrap.php.cache');
         require_once $path . 'app/AppKernel.php';
         $kernel = new AppKernel($env, true);
         $kernel->loadClassCache();
         $kernel->boot();
         $this->kernel = $kernel;
         $this->container = $kernel->getContainer();
         if ($this->container->get('session')->isStarted() == false) {
             $this->container->get('session')->start();
         }
         if ($url != null) {
             $this->overloadUrlContext($url);
         }
     } else {
         $this->kernel = $kernel;
         $this->container = $kernel->getContainer();
     }
     $wp_loader = $this->container->get('wordpress.loader');
     $wp_loader->load();
 }
开发者ID:cmoncy,项目名称:WordpressBundle,代码行数:33,代码来源:sf2plugin.php

示例3: setUp

 protected function setUp()
 {
     $kernel = new \AppKernel('test', false);
     $kernel->boot();
     $this->articleRepository = $kernel->getContainer()->get('app.article_repository');
     $this->queryBus = $kernel->getContainer()->get('gnugat_query_bus.query_bus');
 }
开发者ID:gnugat,项目名称:query-bus-bundle,代码行数:7,代码来源:ServiceTest.php

示例4: __construct

 public function __construct(PHP_CodeCoverage_Driver $driver = NULL, PHP_CodeCoverage_Filter $filter = NULL)
 {
     require $_SERVER['KERNEL_DIR'] . '/AppKernel.php';
     $this->appKernel = new \AppKernel('test', true);
     $this->appKernel->boot();
     $this->twig = $this->appKernel->getContainer()->get('twig');
     $this->twigCacheRegex = '#^' . $this->twig->getCache() . '/././([0-9a-f]+)\\.php$#';
     $filter->addDirectoryToWhitelist($this->twig->getCache());
     parent::__construct($driver, $filter);
 }
开发者ID:Trismegiste,项目名称:thatch,代码行数:10,代码来源:CodeCoverage.php

示例5: __construct

 /**
  * Construct a test case.
  */
 public function __construct()
 {
     parent::__construct();
     self::$kernel = new \AppKernel('test', true);
     self::$kernel->boot();
     self::$application = new Application(self::$kernel);
     self::$application->setAutoExit(false);
     self::$container = self::$kernel->getContainer();
     self::$doctrine = $this->get('doctrine');
 }
开发者ID:ubermichael,项目名称:symftest,代码行数:13,代码来源:FixturesTestCase.php

示例6: testCacheCompilerPass

 public function testCacheCompilerPass()
 {
     static::assertTrue(self::$kernel->getContainer()->has('s.teavee_object_cache.registrar'));
     $registrar = self::$kernel->getContainer()->get('s.teavee_object_cache.registrar');
     static::assertInstanceOf('Scribe\\Teavee\\ObjectCacheBundle\\DependencyInjection\\Compiler\\Registrar\\CacheCompilerRegistrar', $registrar);
     static::assertCount(3, $registrar->getAttendantCollection());
     static::assertTrue(self::$kernel->getContainer()->has('s.teavee_object_cache.key_generator'));
     $g = self::$kernel->getContainer()->get('s.teavee_object_cache.key_generator');
     foreach ($registrar->getAttendantCollection() as $attendant) {
         static::assertEquals($g, $attendant->getKeyGenerator());
     }
 }
开发者ID:scr-be,项目名称:teavee-object-cache-bundle,代码行数:12,代码来源:ScribeTeaveeObjectCacheBundleTest.php

示例7: _initialize

 public function _initialize()
 {
     /** @var CodeceptionModule\Symfony2 $module */
     $module = $this->getModule('Symfony2');
     /** @var \AppKernel $kernel */
     $this->kernel = $module->kernel;
     $this->container = $this->kernel->getContainer();
     $this->entityManager = $this->container->get('doctrine.orm.entity_manager');
     $this->fixturesFinder = $this->container->get('hautelook_alice.doctrine.orm.fixtures_finder');
     $this->fixturesLoader = $this->container->get('hautelook_alice.fixtures.loader');
     $this->fixturesExecutor = $this->container->get('hautelook_alice.doctrine.executor.fixtures_executor');
     $this->bundleResolver = $this->container->get('hautelook_alice.bundle_resolver');
     $this->schemaTool = new SchemaTool($this->entityManager);
 }
开发者ID:alsbury,项目名称:malice,代码行数:14,代码来源:Malice.php

示例8: setServiceKernel

 /**
  * 每个testXXX执行之前,都会执行此函数,净化数据库。
  * 
  * NOTE: 如果数据库已创建,那么执行清表操作,不重建。
  */
 private function setServiceKernel()
 {
     $kernel = new \AppKernel('test', false);
     $kernel->loadClassCache();
     $kernel->boot();
     Request::enableHttpMethodParameterOverride();
     $request = Request::createFromGlobals();
     $serviceKernel = ServiceKernel::create($kernel->getEnvironment(), $kernel->isDebug());
     $serviceKernel->setParameterBag($kernel->getContainer()->getParameterBag());
     $serviceKernel->setConnection($kernel->getContainer()->get('database_connection'));
     $currentUser = new CurrentUser();
     $currentUser->fromArray(array('id' => 1, 'nickname' => 'admin', 'email' => 'admin@admin.com', 'password' => 'admin', 'currentIp' => '127.0.0.1', 'roles' => array('ROLE_USER', 'ROLE_ADMIN', 'ROLE_SUPER_ADMIN', 'ROLE_TEACHER')));
     $serviceKernel->setCurrentUser($currentUser);
     $this->serviceKernel = $serviceKernel;
 }
开发者ID:styling,项目名称:LeesPharm,代码行数:20,代码来源:BaseTestCase.php

示例9: __construct

 public function __construct()
 {
     $kernel = new \AppKernel("test", true);
     $kernel->boot();
     $this->_container = $kernel->getContainer();
     $this->searchEngine = $this->get('beecms.search.service');
 }
开发者ID:beecms,项目名称:search-bundle,代码行数:7,代码来源:SearchEngineTest.php

示例10: setUp

 protected function setUp()
 {
     $kernel = new \AppKernel('test', true);
     $kernel->boot();
     $this->container = $kernel->getContainer();
     $this->youtube = $this->container->get('awy.google.youtube');
 }
开发者ID:andywooyay,项目名称:AwyGoogleApiBundle,代码行数:7,代码来源:YoutubeTest.php

示例11: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $environments = explode(',', $input->getArgument('environments'));
     $table = (new Table($output))->setHeaders(['env', 'key', 'value']);
     foreach ($environments as $key => $environment) {
         if ($key > 0) {
             $table->addRow(new TableSeparator());
         }
         $environmentKernel = new \AppKernel($environment, false);
         $environmentKernel->initializeWithoutCaching();
         foreach ($environmentKernel->getContainer()->getParameterBag()->all() as $parameter => $value) {
             if ($input->getOption('filter') !== null) {
                 $pattern = sprintf('~%s~', $input->getOption('filter'));
                 if (!preg_match($pattern, $parameter)) {
                     continue;
                 }
             }
             if (is_array($value)) {
                 $value = json_encode($value);
             }
             $table->addRow([$environment, $parameter, $value]);
         }
     }
     $table->render();
 }
开发者ID:kmelia,项目名称:fresh-symfony,代码行数:25,代码来源:ParametersCommand.php

示例12: __construct

 public function __construct()
 {
     $kernel = new AppKernel('test', true);
     $kernel->boot();
     $this->em = $kernel->getContainer()->get('doctrine.orm.entity_manager');
     $this->kernel = $kernel;
 }
开发者ID:heristop,项目名称:HeriWebServiceBundle,代码行数:7,代码来源:ClientTest.php

示例13: __construct

 public function __construct()
 {
     $kernel = new \AppKernel("test", true);
     $kernel->boot();
     $this->container = $kernel->getContainer();
     parent::__construct();
 }
开发者ID:vladislavs1321,项目名称:demo,代码行数:7,代码来源:SearchServiceTest.php

示例14: setUp

 public function setUp()
 {
     $kernel = new \AppKernel('test', true);
     $kernel->boot();
     $this->container = $kernel->getContainer();
     $this->service = $this->container->get('dugun_upload.service.upload_service');
 }
开发者ID:duguncom,项目名称:DugunUploadBundle,代码行数:7,代码来源:DownloadTest.php

示例15: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     require_once "{$_SERVER['KERNEL_DIR']}/AppKernel.php";
     $kernel = new \AppKernel('test', true);
     $kernel->boot();
     self::$validator = $kernel->getContainer()->get('validator');
 }
开发者ID:kadala,项目名称:AcmePizzaBundle,代码行数:7,代码来源:AbstractEntityTest.php


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