/**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\PhpFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.php');
 }
 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new Loader\XmlFileLoader($container, new FileLocator(dirname(__DIR__) . '/Resources/config'));
     $loader->load('service_bus.xml');
     $loader->load('event_store.xml');
     $loader = new Loader\PhpFileLoader($container, new FileLocator(dirname(__DIR__) . '/Resources/config'));
     $loader->load('config.php');
 }
    /**
     * @covers Symfony\Component\DependencyInjection\Loader\PhpFileLoader::load
     */
    public function testLoad()
    {
        $loader = new PhpFileLoader($container = new ContainerBuilder(), new FileLocator());

        $loader->load(__DIR__.'/../Fixtures/php/simple.php');

        $this->assertEquals('foo', $container->getParameter('foo'), '->load() loads a PHP file resource');
    }
Beispiel #4
0
 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\PhpFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     // загружаем свои сервисы
     $loader->load('services.php');
     $container->setParameter('twig.form.resources', array_merge($container->getParameter('twig.form.resources'), array('GeoDataBundle:Form:fields.html.twig', 'GeoDataBundle:Form:fields2.html.twig')));
 }
 public function createContainerFromPhpConfig(array $config)
 {
     $container = new ContainerBuilder();
     $container->setParameter('api.endpoint', $config['api']);
     $container->setParameter('api.key', $config['key']);
     $loader = new PhpFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.php');
     return $container;
 }
Beispiel #6
0
 public function __construct()
 {
     $container = new ContainerBuilder();
     $phpLoader = new PhpFileLoader($container, new FileLocator(APPPATH));
     $phpLoader->load('services/services.php');
     foreach (glob(APPPATH . 'modules/*/services', GLOB_ONLYDIR) as $m) {
         if (file_exists($m . '/services.yml')) {
             $loader = new YamlFileLoader($container, new FileLocator($m . '/'));
             $loader->load('services.yml');
         }
     }
     $this->container = $container;
 }
 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $phpLoader = new Loader\PhpFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $xmlLoader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     if (isset($config['access_token'])) {
         $phpLoader->load('parameters.php');
         $xmlLoader->load('services.xml');
         $container->setParameter('staffim_rollbar.rollbar.access_token', $config['access_token']);
         $container->setParameter('staffim_rollbar.rollbar.error_level', $config['error_level']);
         $container->setParameter('staffim_rollbar.scrub_exceptions', $config['scrub']['exceptions']);
         $container->setParameter('staffim_rollbar.scrub_parameters', $config['scrub']['parameters']);
         $container->setParameter('staffim_rollbar.notify_http_exception', $config['notify_http_exception']);
     }
     if ($config['notify_http_exception']) {
         $container->removeDefinition('staffim_rollbar.http_exception_voter');
     }
 }
Beispiel #8
0
 /**
  * Load configuration and start building the routes.
  *
  * @param object $resource
  * @param string $type
  * @throws RuntimeException If the framework is already loaded.
  * @return Symfony\Component\Routing\Route[]
  */
 public function load($resource, $type = null)
 {
     if (true === $this->loaded) {
         throw new \RuntimeException('Framework can only be loaded once.');
     }
     $routes = new RouteCollection();
     $routesWithParameters = new RouteCollection();
     $container = new ContainerBuilder();
     $loader = new PhpFileLoader($container, new FileLocator($this->kernel->getConfigDir()));
     $loader->load('parameters.php');
     $this->locale = $container->getParameter('locale');
     $this->host = $container->getParameter('host');
     $this->supportedLocales = explode(",", $container->getParameter('supportedLocales'));
     if (!in_array($this->locale, $this->supportedLocales)) {
         $this->locale = $this->supportedLocales[0];
     }
     $routes = $this->buildRoutes($routes, $routesWithParameters);
     $newRoutes = array();
     $i = 0;
     $i2 = $routes->count();
     foreach ($routesWithParameters->all() as $r) {
         if (substr($r->getPath(), 0, 8) == "/{param1") {
             // die("F:" . $r->getPath());
             $newRoutes[$i2] = $r;
             $i2++;
         } else {
             $newRoutes[$i] = $r;
             $i++;
         }
     }
     ksort($newRoutes);
     foreach ($newRoutes as $r) {
         $routes->add($r->getPath(), $r);
     }
     $this->loaded = true;
     return $routes;
 }
 /**
  * @param string $file
  * @param string $type
  * @return ContainerBuilder
  */
 private function loadContainerFromFile($file, $type)
 {
     $container = new ContainerBuilder();
     $container->setParameter('kernel.debug', false);
     $container->setParameter('kernel.cache_dir', sys_get_temp_dir());
     $container->registerExtension(new PolyfonyPaymentExtension());
     $locator = new FileLocator(__DIR__ . '/Fixtures/config/' . $type);
     switch ($type) {
         case 'xml':
             $loader = new XmlFileLoader($container, $locator);
             break;
         case 'yml':
             $loader = new YamlFileLoader($container, $locator);
             break;
         case 'php':
             $loader = new PhpFileLoader($container, $locator);
             break;
     }
     $loader->load($file . '.' . $type);
     $container->getCompilerPassConfig()->setOptimizationPasses(array());
     $container->getCompilerPassConfig()->setRemovingPasses(array());
     $container->compile();
     return $container;
 }
 protected function loadFromFile(ContainerBuilder $container, $file)
 {
     $loadXml = new PhpFileLoader($container, new FileLocator(__DIR__ . '/Fixtures/php'));
     $loadXml->load($file . '.php');
 }
 /**
  * @param array $configs
  * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
  * @return void
  * @throws \Laelaps\Bundle\FacebookAuthentication\Exception\MissingBundleDependency
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     list($facebookApplicationConfiguration, $bundleConfiguration) = $configs;
     $this->setFacebookApplicationConfiguration($facebookApplicationConfiguration);
     $loader = new PhpFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.php');
 }
 /**
  * {@inheritdoc}
  */
 public function prepend(ContainerBuilder $container)
 {
     $fileLocator = new FileLocator(__DIR__ . '/../Resources/config');
     $loader = new Loader\PhpFileLoader($container, $fileLocator);
     $loader->load('ckfinder_config.php');
 }
 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new Loader\PhpFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('parameters.php');
     $loader->load('services.php');
 }
 /**
  * @param string $file
  * @param string $type
  * @param array  $services
  *
  * @return ContainerBuilder
  */
 private function loadContainerFromFile($file, $type, array $services = array())
 {
     $container = new ContainerBuilder();
     $container->setParameter('kernel.debug', false);
     $container->setParameter('kernel.cache_dir', '/tmp');
     foreach ($services as $id => $service) {
         $container->set($id, $service);
     }
     $container->registerExtension(new SwiftmailerExtension());
     $locator = new FileLocator(__DIR__ . '/Fixtures/config/' . $type);
     switch ($type) {
         case 'xml':
             $loader = new XmlFileLoader($container, $locator);
             break;
         case 'yml':
             $loader = new YamlFileLoader($container, $locator);
             break;
         case 'php':
             $loader = new PhpFileLoader($container, $locator);
             break;
     }
     $loader->load($file . '.' . $type);
     $container->getCompilerPassConfig()->setOptimizationPasses(array(new ResolveDefinitionTemplatesPass()));
     $container->getCompilerPassConfig()->setRemovingPasses(array());
     $container->compile();
     return $container;
 }