public function __construct(ContainerInterface $container, \Twig_LoaderInterface $loader = null, $options = array()) { parent::__construct($loader, $options); foreach ($container->findAnnotatedServiceIds('twig.extension') as $id => $attributes) { $this->addExtension($container->get($id)); } }
public function boot(ContainerInterface $container) { require_once $container->getParameter('propel.path') . '/runtime/lib/Propel.php'; if (0 === strncasecmp(PHP_SAPI, 'cli', 3)) { set_include_path($container->getParameter('propel.phing_path') . '/classes' . PATH_SEPARATOR . get_include_path()); } $kernel = $container->getKernelService(); if (!file_exists($autoload = $kernel->getCacheDir() . '/propel_autoload.php')) { $map = array(); foreach ($kernel->getBundles() as $bundle) { if (!file_exists($file = $bundle->getPath() . '/Resources/config/classmap.php')) { continue; } $local = (include $file); foreach ($local as $class => $path) { $map[$class] = $bundle->getPath() . '/' . $path; } } file_put_contents($autoload, '<?php return ' . var_export($map, true) . ';'); } $autoloader = \PropelAutoloader::getInstance(); $autoloader->addClassPaths(include $autoload); $autoloader->register(); $container->getPropelService(); }
public function boot(ContainerInterface $container) { require_once $container->getParameter('propel.path') . '/runtime/lib/Propel.php'; if (0 === strncasecmp(PHP_SAPI, 'cli', 3)) { set_include_path($container->getParameter('propel.phing_path') . '/classes' . PATH_SEPARATOR . get_include_path()); } $container->getPropelService(); }
/** * Constructor. * * @param \Symfony\Components\DependencyInjection\ContainerInterface $container A ContainerInterface instance * @param \Symfony\Components\Routing\Loader\LoaderInterface[] $loaders An array of loaders */ public function __construct(ContainerInterface $container, array $loaders = array()) { parent::__construct($loaders); $this->container = $container; foreach ($container->findAnnotatedServiceIds('routing.loader') as $id => $attributes) { $this->services[] = $id; } }
public function buildContainer(ContainerInterface $container) { Loader::registerExtension(new WebExtension()); $dirs = array('%kernel.root_dir%/views/%%bundle%%/%%controller%%/%%name%%%%format%%.php'); foreach ($container->getParameter('kernel.bundle_dirs') as $dir) { $dirs[] = $dir . '/%%bundle%%/Resources/views/%%controller%%/%%name%%%%format%%.php'; } $container->setParameter('templating.loader.filesystem.path', $dirs); }
/** * @param Symfony\Components\DependencyInjection\ContainerInterface $container */ public function __construct(ContainerInterface $container) { foreach ($container->findAnnotatedServiceIds('server.request_handler') as $id => $attributes) { $container->getService($id)->register($this); } foreach ($container->findAnnotatedServiceIds('server.response_filter') as $id => $attributes) { $container->getService($id)->register($this); } }
/** * Constructor. * */ public function __construct(ContainerInterface $container) { $this->container = $container; foreach ($container->findAnnotatedServiceIds('kernel.listener') as $id => $attributes) { foreach ($attributes as $attribute) { if (isset($attribute['event'])) { $this->connect($attribute['event'], array($id, isset($attribute['method']) ? $attribute['method'] : 'handle')); } } } }
public function buildContainer(ContainerInterface $container) { Loader::registerExtension(new WebExtension()); $dirs = array('%kernel.root_dir%/views/%%bundle%%/%%controller%%/%%name%%%%format%%.php'); foreach ($container->getParameter('kernel.bundle_dirs') as $dir) { $dirs[] = $dir . '/%%bundle%%/Resources/views/%%controller%%/%%name%%%%format%%.php'; } $container->setParameter('templating.loader.filesystem.path', $dirs); $configuration = new BuilderConfiguration(); if ($container->getParameter('kernel.debug')) { $loader = new XmlFileLoader(__DIR__ . '/Resources/config'); $configuration->merge($loader->load('debug.xml')); } return $configuration; }
public function buildContainer(ContainerInterface $container) { $kernelBundleDirs = $container->getParameter('kernel.bundle_dirs'); $kernelBundles = $container->getParameter('kernel.bundles'); $appName = $container->getParameter('kernel.name'); $cacheDir = $container->getParameter('kernel.cache_dir'); Loader::registerExtension(new MongoDBExtension($kernelBundleDirs, $kernelBundles, $appName, $cacheDir)); $metadataDirs = array(); $documentDirs = array(); $bundleDirs = $kernelBundleDirs; foreach ($kernelBundles as $className) { $tmp = dirname(str_replace('\\', '/', $className)); $namespace = str_replace('/', '\\', dirname($tmp)); $class = basename($tmp); if (isset($bundleDirs[$namespace])) { if (is_dir($dir = $bundleDirs[$namespace] . '/' . $class . '/Resources/config/doctrine/metadata')) { $metadataDirs[] = realpath($dir); } if (is_dir($dir = $bundleDirs[$namespace] . '/' . $class)) { $documentDirs[] = realpath($dir); } } } $container->setParameter('doctrine.odm.metadata_driver.mapping_dirs', $metadataDirs); $container->setParameter('doctrine.odm.document_dirs', $documentDirs); }
/** * Boots the Bundle. * * @param Symfony\Components\DependencyInjection\ContainerInterface $container A ContainerInterface instance */ public function boot(ContainerInterface $container) { $container->getErrorHandlerService(); // load core classes if ($container->getParameter('kernel.include_core_classes')) { ClassCollectionLoader::load($container->getParameter('kernel.compiled_classes'), $container->getParameter('kernel.cache_dir'), 'classes', $container->getParameter('kernel.debug')); } }
public function buildContainer(ContainerInterface $container) { Loader::registerExtension(new DoctrineExtension($container->getParameter('kernel.bundle_dirs'), $container->getParameter('kernel.bundles'))); $metadataDirs = array(); $entityDirs = array(); $bundleDirs = $container->getParameter('kernel.bundle_dirs'); foreach ($container->getParameter('kernel.bundles') as $className) { $tmp = dirname(str_replace('\\', '/', $className)); $namespace = str_replace('/', '\\', dirname($tmp)); $class = basename($tmp); if (isset($bundleDirs[$namespace])) { if (is_dir($dir = $bundleDirs[$namespace] . '/' . $class . '/Resources/config/doctrine/metadata')) { $metadataDirs[] = realpath($dir); } if (is_dir($dir = $bundleDirs[$namespace] . '/' . $class . '/Entities')) { $entityDirs[] = realpath($dir); } } } $container->setParameter('doctrine.orm.metadata_driver.mapping_dirs', $metadataDirs); $container->setParameter('doctrine.orm.entity_dirs', $entityDirs); }
public function __construct(ContainerInterface $container, LoggerInterface $logger = null) { $this->container = $container; $this->logger = $logger; $this->esiSupport = $container->has('esi') && $container->getEsiService()->hasSurrogateEsiCapability($container->getRequestService()); }
public function buildContainer(ContainerInterface $container) { Loader::registerExtension(new MongoDBExtension($container->getParameter('kernel.bundles'))); }
public function __construct(ContainerInterface $container) { foreach ($container->findAnnotatedServiceIds('kernel.listener') as $id => $attributes) { $container->get($id)->register($this); } }
public function buildContainer(ContainerInterface $container) { $container->setParameter('test.client.class', 'Application\\AddressBookBundle\\Test\\Client'); }