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


PHP Application::getKernel方法代码示例

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


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

示例1: setApplicationDocumentManager

 public static function setApplicationDocumentManager(Application $application, $dmName)
 {
     $service = null === $dmName ? 'doctrine_phpcr.odm.document_manager' : 'doctrine_phpcr.odm.' . $dmName . '_document_manager';
     $documentManager = $application->getKernel()->getContainer()->get($service);
     $helperSet = $application->getHelperSet();
     $helperSet->set(new DocumentManagerHelper(null, $documentManager));
 }
开发者ID:rejsmont,项目名称:DoctrinePHPCRBundle,代码行数:7,代码来源:DoctrineCommandHelper.php

示例2: load

 public function load(Application $application)
 {
     $in = $this->container->getParameter('seed.directory');
     //add seed:load and seed:unload commands
     $application->add($this->container->get('seed.load_seeds_command'));
     $application->add($this->container->get('seed.unload_seeds_command'));
     //Go through bundles and add *Seeds available in seed.directory
     foreach ($application->getKernel()->getBundles() as $bundle) {
         if (!is_dir($dir = sprintf('%s/%s', $bundle->getPath(), $in))) {
             continue;
         }
         $finder = new Finder();
         $finder->files()->name('*Seed.php')->in($dir);
         $prefix = $bundle->getNameSpace() . '\\' . strtr($in, '/', '\\');
         foreach ($finder as $file) {
             $ns = $prefix;
             if ($relativePath = $file->getRelativePath()) {
                 $ns .= '\\' . strtr($relativePath, '/', '\\');
             }
             $class = $ns . '\\' . $file->getBasename('.php');
             $alias = 'seed.command.' . strtolower(str_replace('\\', '_', $class));
             if ($this->container->has($alias)) {
                 continue;
             }
             $r = new \ReflectionClass($class);
             if ($r->isSubclassOf('Soyuka\\SeedBundle\\Command\\Seed') && !$r->isAbstract() && ($r->hasMethod('load') || $r->hasMethod('unload'))) {
                 $application->add($r->newInstanceArgs([$this->prefix, $this->separator]));
             }
         }
     }
 }
开发者ID:soyuka,项目名称:SeedBundle,代码行数:31,代码来源:Loader.php

示例3: registerCommands

 public function registerCommands(Application $application)
 {
     $container = $application->getKernel()->getContainer();
     $commands = $container->getParameter('swarrot.commands');
     foreach ($commands as $command) {
         $application->add($container->get($command));
     }
 }
开发者ID:virhi,项目名称:SwarrotBundle,代码行数:8,代码来源:SwarrotBundle.php

示例4: registerCommands

 public function registerCommands(Application $application)
 {
     $config = $application->getKernel()->getContainer()->getParameter('mongrate_bundle');
     $application->add(new \Mongrate\MongrateBundle\Command\ToggleMigrationCommand($config));
     $application->add(new \Mongrate\MongrateBundle\Command\GenerateMigrationCommand($config));
     $application->add(new \Mongrate\MongrateBundle\Command\UpCommand($config));
     $application->add(new \Mongrate\MongrateBundle\Command\DownCommand($config));
     $application->add(new \Mongrate\MongrateBundle\Command\ListCommand($config));
     $application->add(new \Mongrate\MongrateBundle\Command\TestCommand($config));
 }
开发者ID:amyboyd,项目名称:mongrate-bundle,代码行数:10,代码来源:MongrateBundle.php

示例5: setApplicationConnection

 public static function setApplicationConnection(Application $application, $connName)
 {
     $connection = $application->getKernel()->getContainer()->get('doctrine')->getConnection($connName);
     $helperSet = $application->getHelperSet();
     $helperSet->set(new ConnectionHelper($connection), 'db');
 }
开发者ID:rfc1483,项目名称:blog,代码行数:6,代码来源:DoctrineCommandHelper.php

示例6: registerCommands

 public function registerCommands(Application $application)
 {
     /** @var $application FrameworkApplication */
     $container = $application->getKernel()->getContainer();
     $application->add($container->get('maxmode_generator.sonata_admin.generator'));
 }
开发者ID:maxmode,项目名称:generator,代码行数:6,代码来源:MaxmodeGeneratorBundle.php

示例7: setApplicationDocumentManager

 public static function setApplicationDocumentManager(Application $application, $dmName)
 {
     $documentManager = $application->getKernel()->getContainer()->get('doctrine_couchdb.odm.' . $dmName . '_document_manager');
     $helperSet = $application->getHelperSet();
     $helperSet->set(new CouchDBHelper(null, $documentManager));
 }
开发者ID:jmaheux,项目名称:DoctrineCouchDBBundle,代码行数:6,代码来源:DoctrineCommandHelper.php


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