コード例 #1
0
ファイル: Environment.php プロジェクト: bill97420/symfony
 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));
     }
 }
コード例 #2
0
ファイル: Bundle.php プロジェクト: poulikov/symfony
 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();
 }
コード例 #3
0
ファイル: PropelBundle.php プロジェクト: khalid05/symfony
 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();
 }
コード例 #4
0
ファイル: LoaderResolver.php プロジェクト: khalid05/symfony
 /**
  * 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;
     }
 }
コード例 #5
0
ファイル: Bundle.php プロジェクト: pablosik/symfony
 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);
 }
コード例 #6
0
 /**
  * @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);
     }
 }
コード例 #7
0
 /**
  * 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'));
             }
         }
     }
 }
コード例 #8
0
ファイル: Bundle.php プロジェクト: jacques-sounvi/addressbook
 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;
 }
コード例 #9
0
 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);
 }
コード例 #10
0
ファイル: KernelBundle.php プロジェクト: poulikov/symfony
 /**
  * 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'));
     }
 }
コード例 #11
0
ファイル: Bundle.php プロジェクト: jacques-sounvi/addressbook
 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);
 }
コード例 #12
0
 public function __construct(ContainerInterface $container, LoggerInterface $logger = null)
 {
     $this->container = $container;
     $this->logger = $logger;
     $this->esiSupport = $container->has('esi') && $container->getEsiService()->hasSurrogateEsiCapability($container->getRequestService());
 }
コード例 #13
0
 public function buildContainer(ContainerInterface $container)
 {
     Loader::registerExtension(new MongoDBExtension($container->getParameter('kernel.bundles')));
 }
コード例 #14
0
ファイル: bootstrap.php プロジェクト: khalid05/symfony
 public function __construct(ContainerInterface $container)
 {
     foreach ($container->findAnnotatedServiceIds('kernel.listener') as $id => $attributes) {
         $container->get($id)->register($this);
     }
 }
コード例 #15
0
ファイル: Bundle.php プロジェクト: jacques-sounvi/addressbook
 public function buildContainer(ContainerInterface $container)
 {
     $container->setParameter('test.client.class', 'Application\\AddressBookBundle\\Test\\Client');
 }