/** * Load routes of the specified module from the module's configuration file. * * @param AbstractBundle $bundle * * @return RouteCollection[] */ private function find(AbstractBundle $bundle) { if (!\ServiceUtil::hasContainer()) { \ServiceUtil::setContainer($this->container); } try { $path = $this->zikulaKernel->locateResource($bundle->getRoutingConfig()); } catch (\InvalidArgumentException $e) { // Routing file does not exist (e.g. because the bundle could not be located). return [new RouteCollection(), new RouteCollection(), new RouteCollection()]; } $name = $bundle->getName(); $topRouteCollection = new RouteCollection(); $middleRouteCollection = new RouteCollection(); $bottomRouteCollection = new RouteCollection(); /** * These are all routes of the module, as loaded by Symfony. * @var RouteCollection $routeCollection */ $routeCollection = $this->import($path); // Add all resources from the imported route collection to the middleRouteCollection. // The actual collection (top, middle, bottom) to add the resources too does not matter, // they just must be added to one of them, so that they don't get lost. foreach ($routeCollection->getResources() as $resource) { $middleRouteCollection->addResource($resource); } // It would be great to auto-reload routes here if the module version changes or a module is uninstalled. // This is not yet possible, see // - https://github.com/symfony/symfony/issues/7176 // - https://github.com/symfony/symfony/pull/15738 // - https://github.com/symfony/symfony/pull/15692 // $routeCollection->addResource(new ZikulaResource()) /** @var Route $route */ foreach ($routeCollection as $oldRouteName => $route) { // set break here with $oldRouteName == 'zikula_routesmodule_route_renew' $this->fixRequirements($route); $this->prependBundlePrefix($route, $bundle); list($type, $func) = $this->setZikulaDefaults($route, $bundle, $name); $routeName = $this->getRouteName($oldRouteName, $name, $type, $func); if ($route->hasOption('zkPosition')) { switch ($route->getOption('zkPosition')) { case 'top': $topRouteCollection->add($routeName, $route); break; case 'bottom': $bottomRouteCollection->add($routeName, $route); break; default: throw new \RuntimeException('Unknown route position. Got "' . $route->getOption('zkPosition') . '", expected "top" or "bottom"'); } } else { $middleRouteCollection->add($routeName, $route); } } return [$middleRouteCollection, $topRouteCollection, $bottomRouteCollection]; }
class_alias('\\Zikula\\CategoriesModule\\Entity\\AbstractCategoryAssignment', '\\Zikula\\Core\\Doctrine\\Entity\\AbstractEntityCategory', true); $kernelConfig = Yaml::parse(file_get_contents(__DIR__ . '/../app/config/parameters.yml')); if (is_readable($file = __DIR__ . '/../app/config/custom_parameters.yml')) { $kernelConfig = array_merge($kernelConfig, Yaml::parse(file_get_contents($file))); } $kernelConfig = $kernelConfig['parameters']; if ($kernelConfig['env'] !== 'prod') { // hide deprecation errors // @todo remove exclusions for Core-2.0 Debug::enable(E_ALL & ~E_USER_DEPRECATED); } if (isset($kernelConfig['umask']) && !is_null($kernelConfig['umask'])) { umask($kernelConfig['umask']); } require __DIR__ . '/../app/ZikulaKernel.php'; $kernel = new ZikulaKernel($kernelConfig['env'], $kernelConfig['debug']); $kernel->boot(); // legacy handling $core = new Zikula_Core(); $core->setKernel($kernel); $core->boot(); // these two events are called for BC only. remove in 2.0.0 $core->getDispatcher()->dispatch('bootstrap.getconfig', new GenericEvent($core)); $core->getDispatcher()->dispatch('bootstrap.custom', new GenericEvent($core)); foreach ($GLOBALS['ZConfig'] as $config) { $core->getContainer()->loadArguments($config); } $GLOBALS['ZConfig']['System']['temp'] = $core->getContainer()->getParameter('temp_dir'); $GLOBALS['ZConfig']['System']['datadir'] = $core->getContainer()->getParameter('datadir'); $GLOBALS['ZConfig']['System']['system.chmod_dir'] = $core->getContainer()->getParameter('system.chmod_dir'); ServiceUtil::getManager($core);