public function load($resource, $type = null)
 {
     if (true === $this->loaded) {
         throw new \RuntimeException('Do not add this loader twice');
     }
     //$modules = $this->doctrine->getRepository('MaximCMSBundle:Module')->findBy(array("activated" => 1));
     $collection = new RouteCollection();
     /* FIND ROUTING FILES IN BUNDLES AND LOAD THOSE */
     $exclude = array("CMSBundle", "InstallBundle", "AdminBundle");
     $names = array("routing.yml", "routing_admin.yml");
     for ($i = 0; $i < count($names); $i++) {
         $finder = new Finder();
         $finder->name($names[$i]);
         foreach ($finder->in(__DIR__ . "/../../")->exclude($exclude) as $file) {
             $locator = new FileLocator(array(substr($file, 0, count($file) - (strlen($names[$i]) + 1))));
             $loader = new YamlFileLoader($locator);
             $collection->addCollection($loader->load($names[$i]));
         }
     }
     return $collection;
     /*if (true === $this->loaded) {
                 throw new \RuntimeException('Do not add this loader twice');
             }
     
             $collection = new RouteCollection();
                                      echo "hi";
             // get all Bundles
             $bundles = $this->container->getParameter('kernel.bundles');
             foreach($bundles as $bundle) {
                 if(isset($bundle)) {
     
                        echo $bundle;
     
                 }
             }
     
     
             /*$resource = '@AcmeDemoBundle/Resources/config/import_routing.yml';
             $type = 'yaml';
     
             $importedRoutes = $this->import($resource, $type);
     
             $collection->addCollection($importedRoutes);
     
             return $collection;          */
 }
Пример #2
0
 /**
  * Handles the landmarx_landmark configuration.
  *
  * @param array $configs The configurations being loaded
  * @param ContainerBuilder $container
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('landmark.yml');
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     foreach ($config['providers'] as $builder => $enabled) {
         if ($enabled) {
             $container->getDefinition(sprintf('landmarx_landmark.landmark_provider.%s', $builder))->addTag('landmarx_landmark.provider');
         }
     }
     if (isset($config['twig'])) {
         $loader->load('twig.xml');
         $container->setParameter('landmarx_landmark.renderer.twig.template', $config['twig']['template']);
     }
     if ($config['templating']) {
         $loader->load('templating.xml');
     }
     $container->setParameter('landmarx_landmark.default_renderer', $config['default_renderer']);
 }
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('feeds.yml');
 }
 protected function loadFromFile(ContainerBuilder $container, $file)
 {
     $loadXml = new YamlFileLoader($container, new FileLocator(__DIR__ . '/Fixtures/config/xml'));
     $loadXml->load($file . '.xml');
 }