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


PHP AppKernel类代码示例

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


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

示例1: 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

示例2: __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

示例3: 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

示例4: 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

示例5: process

 /**
  * @param AppKernel $kernel
  * @param \Zero\Component\Kernel\Container $app_container
  * @throws \Exception
  */
 public static function process(AppKernel $kernel, $app_container)
 {
     global $argv;
     if (!isset($argv[1])) {
         throw new \Exception("命令行第一个参数应该是需要调用的方法");
     }
     $controller = $argv[1];
     if (strpos($controller, ':') === false) {
         throw new \Exception("第一个参数错误,格式应该为<module_name>:<command_name>:<action_name>");
     }
     $arguments = array_splice($argv, 2);
     try {
         list($module_name, $command_name, $action_name) = explode(':', $controller);
         $module = $kernel->getModule($module_name);
         $command = $module->getCommand($command_name, $action_name);
         if (method_exists($command, '__invoke')) {
             /** @var \Symfony\Component\HttpFoundation\Response $response */
             call_user_func_array($command, $arguments);
         } else {
             throw new \Exception('Command must has the __invoke public function!');
         }
     } catch (\Exception $e) {
         throw $e;
     }
 }
开发者ID:aeshion,项目名称:ZeroPHP,代码行数:30,代码来源:CommandProcessor.php

示例6: 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

示例7: __construct

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

示例8: bootstrapApplication

 protected static function bootstrapApplication()
 {
     $kernel = new \AppKernel(static::$environment, static::$debug);
     $kernel->boot();
     static::$application = new Application($kernel);
     static::$application->setAutoExit(false);
 }
开发者ID:noregression,项目名称:test-bundle,代码行数:7,代码来源:IsolatedTestTrait.php

示例9: prepend

 /**
  * @param ContainerBuilder $container
  *
  * @return void
  */
 public function prepend(ContainerBuilder $container)
 {
     // Build fos_elastica config for each widget
     $elasticaConfig = [];
     $kernel = new \AppKernel('prod', false);
     $yamlParser = new Yaml();
     foreach ($kernel->registerBundles() as $bundle) {
         /* @var Bundle $bundle */
         $path = $bundle->getPath();
         //If bundle is a widget
         if (0 === strpos($bundle->getNamespace(), 'Victoire\\Widget\\')) {
             //find for a fos_elastica.yml config file
             $widgetConfig = $yamlParser->parse($path . '/Resources/config/config.yml');
             if (is_array($widgetConfig)) {
                 foreach ($widgetConfig['victoire_core']['widgets'] as $_widgetConfig) {
                     if (array_key_exists('fos_elastica', $widgetConfig)) {
                         $_config = ['indexes' => ['widgets' => ['types' => [$_widgetConfig['name'] => ['serializer' => ['groups' => ['search']], 'mappings' => [], 'persistence' => ['driver' => 'orm', 'model' => $_widgetConfig['class'], 'provider' => [], 'listener' => [], 'finder' => []]]]]]];
                         $_config = array_merge_recursive($widgetConfig['fos_elastica'], $_config);
                         $elasticaConfig = array_merge_recursive($elasticaConfig, $_config);
                     }
                 }
             }
         }
     }
     foreach ($container->getExtensions() as $name => $extension) {
         switch ($name) {
             case 'fos_elastica':
                 $container->prependExtensionConfig($name, $elasticaConfig);
                 break;
         }
     }
 }
开发者ID:Charlie-Lucas,项目名称:WidgetSearchBundle,代码行数:37,代码来源:VictoireWidgetSearchExtension.php

示例10: __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

示例11: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     @unlink(__DIR__ . '/../Fixtures/Test/TestBundle/Resources/config/routing.rest.yml');
     @unlink(__DIR__ . '/../Fixtures/Test/TestBundle/Controller/CarController.php');
     @unlink(__DIR__ . '/../Fixtures/Test/TestBundle/Controller/OrderController.php');
     $kernel = new \AppKernel('test', true);
     $app = new Application($kernel);
     $app->addCommands(array(new GenerateRestControllerCommand()));
     $kernel->boot();
     $command = $app->find('generate:rest:controller');
     $commandTester = new CommandTester($command);
     $commandTester->execute(array('command' => $command->getName(), '--controller' => 'TestTestBundle:Order', '--entity' => 'TestTestBundle:Order', '--mongo' => true), array('interactive' => false));
     $kernel->shutdown();
     $kernel = new \AppKernel('test', true);
     $app = new Application($kernel);
     $app->addCommands(array(new GenerateRestControllerCommand()));
     $kernel->boot();
     $command = $app->find('generate:rest:controller');
     $commandTester = new CommandTester($command);
     $commandTester->execute(array('command' => $command->getName(), '--controller' => 'TestTestBundle:Car', '--entity' => 'TestTestBundle:Car'), array('interactive' => false));
     $kernel->shutdown();
     @unlink(__DIR__ . '/../app/cache/test/appTestUrlGenerator.php.meta');
     @unlink(__DIR__ . '/../app/cache/test/appTestUrlGenerator.php');
     @unlink(__DIR__ . '/../app/cache/test/appTestUrlMatcher.php.meta');
     @unlink(__DIR__ . '/../app/cache/test/appTestUrlMatcher.php');
 }
开发者ID:amstaffix,项目名称:extjs-bundle,代码行数:26,代码来源:BaseTestGeneratedRestController.php

示例12: load

 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     $loader->load('forms.yml');
     // We instanciate a new kernel and iterate on all it's bundles to load the victoire_core configs
     $kernel = new \AppKernel('prod', false);
     foreach ($kernel->registerBundles() as $bundle) {
         $path = $bundle->getPath();
         $yamlParser = new Yaml($container, $path . '/Resources/config/config.yml');
         $victoireConfig = $yamlParser->parse($path . '/Resources/config/config.yml');
         if (is_array($victoireConfig) && array_key_exists('victoire_core', $victoireConfig)) {
             $config['widgets'] = array_merge($config['widgets'], $victoireConfig['victoire_core']['widgets'] ?: []);
         }
     }
     $container->setParameter('victoire_core.cache_dir', $config['cache_dir']);
     $container->setParameter('victoire_core.business_entity_debug', $config['business_entity_debug']);
     if (array_key_exists('templates', $config)) {
         $container->setParameter('victoire_core.templates', $config['templates']);
     } else {
         $container->setParameter('victoire_core.templates', '');
     }
     $container->setParameter('victoire_core.widgets', $config['widgets']);
     $container->setParameter('victoire_core.layouts', $config['layouts']);
     $container->setParameter('victoire_core.slots', $config['slots']);
     $container->setParameter('victoire_core.user_class', $config['user_class']);
     $container->setParameter('victoire_core.base_paths', $config['base_paths']);
     $container->setParameter('victoire_core.base_paths', $config['base_paths']);
     $container->setParameter('victoire_core.businessTemplates', $config['businessTemplates']);
 }
开发者ID:victoire,项目名称:victoire,代码行数:35,代码来源:VictoireCoreExtension.php

示例13: buildKernel

 private function buildKernel()
 {
     require_once __DIR__ . "/../../../../../app/AppKernel.php";
     $kernel = new \AppKernel("test", true);
     $kernel->boot();
     return $kernel;
 }
开发者ID:nebuchar,项目名称:ddd-blog,代码行数:7,代码来源:TestsEnvironment.php

示例14: 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

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