/** * Return route collection for injected plugins * * @return RouteCollection Collection generated */ protected function addPluginRoutesCollection(Plugin $plugin) { $routes = new RouteCollection(); $bundleName = $plugin->getBundleName(); $bundle = $this->kernel->getBundle($bundleName); $routingFilePath = '/Resources/config/routing.yml'; $resourcePath = $bundle->getPath() . $routingFilePath; $type = 'yaml'; if (file_exists($resourcePath)) { $routes->addCollection($this->import('@' . $bundle->getName() . $routingFilePath, $type)); } return $routes; }