/** * @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'); }
public function registerContainerConfiguration(LoaderInterface $loader) { $loader->load($this->config); if (PHP_VERSION_ID > 50400) { $loader->load(__DIR__ . '/config/traits.yml'); } }
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'); } }
public function onKernelRequest(GetResponseEvent $event) { if (null !== $this->loader) { // carrega os annotations para criar as rotas dos rests $this->loader->load(''); } }
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')); }
public function registerContainerConfiguration(LoaderInterface $loader) { $loader->load(__DIR__ . '/config/config_plugin.yml'); foreach ($this->pluginAdapter->getConfigurationFiles() as $file) { $loader->load($file); } }
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'); } }
public function registerContainerConfiguration(LoaderInterface $loader) { $loader->load(SuluTestBundle::getConfigDir() . '/config.php'); if (class_exists('Sulu\\Bundle\\SearchBundle\\SuluSearchBundle')) { $loader->load(__DIR__ . '/config/search.yml'); } }
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; }
public function registerContainerConfiguration(LoaderInterface $loader) { $loader->load(__DIR__ . '/config/config_' . $this->getEnvironment() . '.yml'); if (null !== $this->devConfig) { $loader->load($this->devConfig); } }
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'); } }
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); } }
/** * {@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; }
/** * 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); } }
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); } }
/** * {@inheritdoc} */ public function registerContainerConfiguration(LoaderInterface $loader) { $loader->load(__DIR__ . '/config.yml'); if (is_callable($this->configCallback)) { $loader->load($this->configCallback); } }
/** * 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); }
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()); }
/** * {@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); } }
/** * {@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); } }
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; }
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); }); }
public function registerContainerConfiguration(LoaderInterface $loader) { if ($this->getEnvironment() == 'test_mongodb') { $loader->load(__DIR__ . '/config/config_mongodb.yml'); } else { $loader->load(__DIR__ . '/config/config.yml'); } }
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_/']]]); }); }
/** * {@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); } }