本文整理汇总了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));
}
示例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]));
}
}
}
}
示例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));
}
}
示例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));
}
示例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');
}
示例6: registerCommands
public function registerCommands(Application $application)
{
/** @var $application FrameworkApplication */
$container = $application->getKernel()->getContainer();
$application->add($container->get('maxmode_generator.sonata_admin.generator'));
}
示例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));
}