當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。