/**
  * Add symfonize loaded routes to symfony
  */
 public function useSymfonizeRoutes()
 {
     /**
      * @var $router \Symfony\Bundle\FrameworkBundle\Routing\Router
      */
     $this->container->set('router', RouteBridge::getRouteCollection());
 }
Exemple #2
0
 /**
  * Called after all addConfigFolder() calls, this function
  * actually loads all the symfony config files such as
  * services.yml
  */
 public static function loadAll()
 {
     $containerLoader = new ContainerLoader();
     $loadedContainer = $containerLoader->loadDIConfig(self::$cacheDirPath, self::$cacheEnabled, self::$extensions, ContainerBridge::getContainer());
     ContainerBridge::setContainer($loadedContainer);
     $routingLoader = new RoutingLoader();
     $loadedRouteCollection = $routingLoader->loadRouting(self::$bundlePaths, self::$cacheDirPath, self::$cacheEnabled, RouteBridge::getRouteCollection());
     RouteBridge::setRouteCollection($loadedRouteCollection);
 }
 /**
  * Called after all addConfigFolder() calls, this function
  * actually loads all the symfony config files such as
  * services.yml
  */
 public function loadBundles($symfonizeConfig)
 {
     $extensions = [];
     $bundlePaths = [];
     foreach ($symfonizeConfig['bundles'] as $bundle) {
         $extension = $bundle->getContainerExtension();
         if ($extension) {
             $extensions[] = $extension;
         }
         $bundlePaths[] = $bundle->getPath();
     }
     $cacheDir = $symfonizeConfig['cache_dir'] . '/symfonize-cache';
     $containerLoader = new ContainerLoader();
     $loadedContainer = $containerLoader->loadDIConfig($cacheDir, !$symfonizeConfig['debug'], $extensions, ContainerBridge::getContainer());
     ContainerBridge::setContainer($loadedContainer);
     $routingLoader = new RoutingLoader();
     $loadedRouteCollection = $routingLoader->loadRouting($bundlePaths, $cacheDir, !$symfonizeConfig['debug'], RouteBridge::getRouteCollection());
     RouteBridge::setRouteCollection($loadedRouteCollection);
 }