public function __construct(SwitchKernel $kernel, $bundlesFile = null) { $this->kernel = $kernel; if (!$bundlesFile) { $bundlesFile = $kernel->getRootDir() . '/config/bundles.ini'; } BundleManager::initialize($kernel, $bundlesFile); $this->bundleManager = BundleManager::getInstance(); }
/** * @DI\InjectParams({ * "iniFileManager" = @DI\Inject("claroline.manager.ini_file_manager"), * "kernelRootDir" = @DI\Inject("%kernel.root_dir%"), * "om" = @DI\Inject("claroline.persistence.object_manager"), * "kernel" = @DI\Inject("kernel") * }) */ public function __construct(IniFileManager $iniFileManager, $kernelRootDir, ObjectManager $om, KernelInterface $kernel) { $this->iniFileManager = $iniFileManager; $this->kernelRootDir = $kernelRootDir; $this->om = $om; $this->pluginRepo = $om->getRepository('ClarolineCoreBundle:Plugin'); $this->iniFile = $this->kernelRootDir . '/config/bundles.ini'; $this->kernel = $kernel; $this->loadedBundles = parse_ini_file($this->iniFile); BundleManager::initialize($kernel, $this->iniFile); $this->bundleManager = BundleManager::getInstance(); }
public function load($resource, $type = null) { $collection = new RouteCollection(); foreach (BundleManager::getInstance()->getActiveBundles() as $bundle) { foreach ($bundle[BundleManager::BUNDLE_CONFIG]->getRoutingResources() as $resource) { $subCollection = $this->import($resource[ConfigurationBuilder::RESOURCE_OBJECT], $resource[ConfigurationBuilder::RESOURCE_TYPE]); if (!empty($resource[ConfigurationBuilder::ROUTING_PREFIX])) { $subCollection->addPrefix($resource[ConfigurationBuilder::ROUTING_PREFIX]); } $collection->addCollection($subCollection); } } return $collection; }