예제 #1
0
 /**
  * @param string $class
  * @return Metadata
  */
 public function getMetadataFor($class)
 {
     if (!array_key_exists($class, $this->metadata)) {
         $this->metadata[$class] = $this->loader->load($class);
     }
     return $this->metadata[$class];
 }
 /**
  * Loads the container configuration.
  *
  * @param LoaderInterface $loader A LoaderInterface instance
  *
  * @api
  */
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     if (null != $this->config) {
         $loader->load($this->config);
     }
     $loader->load(__DIR__ . '/config/default.yml');
 }
예제 #3
0
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     $loader->load($this->config);
     if (PHP_VERSION_ID > 50400) {
         $loader->load(__DIR__ . '/config/traits.yml');
     }
 }
예제 #4
0
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     $loader->load(__DIR__ . '/config/config_' . $this->getEnvironment() . '.yml');
     if (file_exists(__DIR__ . '/config/parameters.yml')) {
         $loader->load(__DIR__ . '/config/parameters.yml');
     }
 }
예제 #5
0
 public function onKernelRequest(GetResponseEvent $event)
 {
     if (null !== $this->loader) {
         // carrega os annotations para criar as rotas dos rests
         $this->loader->load('');
     }
 }
예제 #6
0
 public function testLoad()
 {
     $this->yamlParser->parse(file_get_contents(__DIR__ . '/../Resources/Yaml/routes.yml'))->willReturn(['user' => ['channel' => 'notification/user/{username}', 'handler' => ['callback' => ['Gos\\Bundle\\PubSubRouterBundle\\Tests\\Model', 'setPushers'], 'args' => ['gos_redis', 'gos_websocket']], 'requirements' => ['username' => ['pattern' => '[a-zA-Z0-9]+', 'wildcard' => true]]], 'application' => ['channel' => 'notification/application/{applicationName}', 'handler' => ['callback' => ['Gos\\Bundle\\PubSubRouterBundle\\Tests\\Model', 'setPushers'], 'args' => ['gos_redis', 'gos_websocket']], 'requirements' => ['applicationName' => ['pattern' => '[a-zA-Z0-9]+', 'wildcard' => true]]]]);
     $this->injectYamlParser();
     $routeCollection = $this->loader->load('@Resource/routes.yml');
     $this->assertEquals(['user' => new Route('notification/user/{username}', ['Gos\\Bundle\\PubSubRouterBundle\\Tests\\Model', 'setPushers'], ['gos_redis', 'gos_websocket'], ['username' => ['pattern' => '[a-zA-Z0-9]+', 'wildcard' => true]]), 'application' => new Route('notification/application/{applicationName}', ['Gos\\Bundle\\PubSubRouterBundle\\Tests\\Model', 'setPushers'], ['gos_redis', 'gos_websocket'], ['applicationName' => ['pattern' => '[a-zA-Z0-9]+', 'wildcard' => true]])], $this->readProperty($routeCollection, 'routes'));
 }
예제 #7
0
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     $loader->load(__DIR__ . '/config/config_plugin.yml');
     foreach ($this->pluginAdapter->getConfigurationFiles() as $file) {
         $loader->load($file);
     }
 }
예제 #8
0
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     $loader->load(__DIR__ . '/config/config_' . $this->getEnvironment() . '.yml');
     $loader->load(__DIR__ . '/config/security.yml');
     $loader->load(__DIR__ . '/config/roles.yml');
     $loader->load(__DIR__ . '/config/resources.yml');
 }
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     $loader->load($this->getRootDir() . '/config/config.yml');
     if ($this->isDebug()) {
         $loader->load($this->getRootDir() . '/config/config_dbg.yml');
     }
 }
예제 #10
0
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     $loader->load(SuluTestBundle::getConfigDir() . '/config.php');
     if (class_exists('Sulu\\Bundle\\SearchBundle\\SuluSearchBundle')) {
         $loader->load(__DIR__ . '/config/search.yml');
     }
 }
예제 #11
0
 public function build()
 {
     $finder = new Finder();
     $finder->in($this->path)->files()->name('*.xml')->sortByName();
     // Iterate over config files, and add a portal object for each config to the collection
     $collection = new WebspaceCollection();
     // reset arrays
     $this->webspaces = [];
     $this->portals = [];
     $this->portalInformations = [];
     foreach ($finder as $file) {
         // add file resource for cache invalidation
         $collection->addResource(new FileResource($file->getRealPath()));
         /** @var Webspace $webspace */
         $webspace = $this->loader->load($file->getRealPath());
         $this->webspaces[] = $webspace;
         $this->buildPortals($webspace);
     }
     $environments = array_keys($this->portalInformations);
     foreach ($environments as $environment) {
         // sort all portal informations by length
         uksort($this->portalInformations[$environment], function ($a, $b) {
             return strlen($a) < strlen($b);
         });
     }
     $collection->setWebspaces($this->webspaces);
     $collection->setPortals($this->portals);
     $collection->setPortalInformations($this->portalInformations);
     return $collection;
 }
예제 #12
0
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     $loader->load(__DIR__ . '/config/config_' . $this->getEnvironment() . '.yml');
     if (null !== $this->devConfig) {
         $loader->load($this->devConfig);
     }
 }
예제 #13
0
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     $loader->load(__DIR__ . '/config/' . $this->environment . '.yml');
     if (class_exists('Dunglas\\ApiBundle\\DunglasApiBundle')) {
         $loader->load(__DIR__ . '/config/dunglas_api.yml');
     }
 }
예제 #14
0
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     $loader->load(__DIR__ . '/config/config_' . $this->getEnvironment() . '.yml');
     if (is_file($file = __DIR__ . '/config/config_' . $this->getEnvironment() . '_local.yml')) {
         $loader->load($file);
     }
 }
예제 #15
0
 /**
  * {@inheritdoc}
  */
 public function load($resource, $type = null)
 {
     if (true === $this->isLoaded) {
         throw new \RuntimeException('Do not add the "modera_routing" loader twice');
     }
     $resources = array();
     $items = $this->resourcesProvider->getItems();
     foreach ($items as $index => $resource) {
         if (!is_array($resource)) {
             $resource = array('resource' => $resource);
         }
         $resource = array_merge(array('order' => 0, 'type' => null), $resource);
         $resource['index'] = $index;
         $resources[] = $resource;
     }
     usort($resources, function ($a, $b) {
         if ($a['order'] == $b['order']) {
             return $a['index'] < $b['index'] ? -1 : 1;
         }
         return $a['order'] < $b['order'] ? -1 : 1;
     });
     $collection = new RouteCollection();
     foreach ($resources as $item) {
         $collection->addCollection($this->rootLoader->load($item['resource'], $item['type']));
     }
     $this->isLoaded = true;
     return $collection;
 }
예제 #16
0
 /**
  * Loads the container configuration.
  *
  * @param LoaderInterface $loader A LoaderInterface instance
  * @api
  */
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     $loader->load(__DIR__ . '/Resources/config/default.yml');
     if ($this->config) {
         $loader->load(__DIR__ . '/Resources/config/' . $this->config);
     }
 }
예제 #17
0
파일: AppKernel.php 프로젝트: skrz/stack
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     $loader->load($this->getRootDir() . "/conf/services_" . $this->getEnvironment() . ".yml");
     if (file_exists($fileName = $this->getRootDir() . "/conf/services_local.yml")) {
         $loader->load($fileName);
     }
 }
예제 #18
0
 /**
  * {@inheritdoc}
  */
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     $loader->load(__DIR__ . '/config.yml');
     if (is_callable($this->configCallback)) {
         $loader->load($this->configCallback);
     }
 }
예제 #19
0
 /**
  * You can modify the container here before it is dumped to PHP code.
  *
  * @param ContainerBuilder $container
  *
  * @api
  */
 public function process(ContainerBuilder $container)
 {
     $this->loader = $container->get('sulu.content.path_cleaner.replacer_loader');
     $service = $container->getDefinition('sulu.content.path_cleaner');
     $replacers = $this->loader->load($this->filename);
     $service->addArgument($replacers);
 }
예제 #20
0
 public function testLoad()
 {
     $importedRouteCollection = new RouteCollection();
     $importedRouteCollection->add('route1', new Route('/example/route1'));
     $importedRouteCollection->add('route2', new Route('/route2'));
     $portal1 = new Portal();
     $portal1->setKey('sulu_lo');
     $portal2 = new Portal();
     $portal2->setKey('sulu_com');
     $portalInformations = [new PortalInformation(null, null, $portal1, null, 'sulu.io/de'), new PortalInformation(null, null, $portal2, null, 'sulu.com')];
     $this->loaderResolver->resolve(Argument::any(), Argument::any())->willReturn($this->loader->reveal());
     $this->loader->load(Argument::any(), Argument::any())->willReturn($importedRouteCollection);
     $this->webspaceManager->getPortalInformations(Argument::any())->willReturn($portalInformations);
     $routeCollection = $this->portalLoader->load('', 'portal');
     $this->assertCount(4, $routeCollection);
     $routes = $routeCollection->getIterator();
     $this->assertArrayHasKey('sulu.io/de.route1', $routes);
     $this->assertArrayHasKey('sulu.io/de.route2', $routes);
     $this->assertArrayHasKey('sulu.com.route1', $routes);
     $this->assertArrayHasKey('sulu.com.route2', $routes);
     $this->assertEquals('/de/example/route1', $routeCollection->get('sulu.io/de.route1')->getPath());
     $this->assertEquals('/de/route2', $routeCollection->get('sulu.io/de.route2')->getPath());
     $this->assertEquals('/example/route1', $routeCollection->get('sulu.com.route1')->getPath());
     $this->assertEquals('/route2', $routeCollection->get('sulu.com.route2')->getPath());
 }
예제 #21
0
 /**
  * {@inheritdoc}
  */
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     $loader->load(__DIR__ . '/config/' . $this->getContext() . '/config_' . $this->getEnvironment() . '.yml');
     $userConfig = __DIR__ . '/config/config.local.yml';
     if (file_exists($userConfig)) {
         $loader->load($userConfig);
     }
 }
예제 #22
0
 /**
  * {@inheritdoc}
  */
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     $rootDir = $this->getRootDir();
     $loader->load($rootDir . '/config/config_' . $this->environment . '.yml');
     if (is_file($file = $rootDir . '/config/config_' . $this->environment . '.local.yml')) {
         $loader->load($file);
     }
 }
예제 #23
0
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     $loader->load(__DIR__ . '/config.yml');
     $configuration = $this->configuration;
     $loader->load(function () use($configuration) {
         return $configuration;
     }, 'closure');
 }
 /**
  * Return the metadata factory.
  *
  * @return MetadataFactory
  */
 public function getMetadataFactory()
 {
     $mappingFactory = new MetadataFactory();
     foreach ($this->resources as $resource) {
         $mappingFactory->addMetadatas($this->loader->load($resource['path'], $resource['type']));
     }
     return $mappingFactory;
 }
예제 #25
0
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     $loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml');
     $envParameters = $this->getEnvParameters();
     $loader->load(function ($container) use($envParameters) {
         $container->getParameterBag()->add($envParameters);
     });
 }
예제 #26
0
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     if ($this->getEnvironment() == 'test_mongodb') {
         $loader->load(__DIR__ . '/config/config_mongodb.yml');
     } else {
         $loader->load(__DIR__ . '/config/config.yml');
     }
 }
예제 #27
0
파일: AppKernel.php 프로젝트: 7rin0/SF3
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     if (self::VERSION_ID < 20800) {
         $loader->load(__DIR__ . '/config/older_versions_config.yml');
     } else {
         $loader->load(__DIR__ . '/config/' . $this->environment . '.yml');
     }
 }
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     $loader->load($this->getRootDir() . '/Resources/config/services.yml');
     $loader->load(function (ContainerBuilder $container) {
         $container->loadFromExtension('framework', ['secret' => '$ecret']);
         $container->loadFromExtension('twig_constant_accessor', ['classes' => ['Foo\\Bar', ['class' => 'ActivationStatus'], ['class' => 'FooBarConstant', 'alias' => 'FooBarAlias'], ['class' => 'RegExp\\Rules', 'matches' => '/^RULE_/']]]);
     });
 }
예제 #29
0
 /**
  * {@inheritdoc}
  */
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     if (version_compare(self::VERSION, '2.7.0', '>=')) {
         $loader->load($this->getRootDir() . '/config/config_27.yml');
         return;
     }
     $loader->load($this->getRootDir() . '/config/config.yml');
 }
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     $loader->load(__DIR__ . '/config/config_' . $this->getEnvironment() . '.yml');
     // load local_*.yml or local.yml
     if (file_exists($file = __DIR__ . '/config/local_' . $this->getEnvironment() . '.yml') || file_exists($file = __DIR__ . '/config/local.yml')) {
         $loader->load($file);
     }
 }