From e9be284c03b0984d770c24fb1c7edc156144b4d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 22 Jan 2015 17:36:49 +0100 Subject: [PATCH] loads routes automatically move routes to config.yml, loaded by prepending configuration refs #273 --- DependencyInjection/ChillPersonExtension.php | 9 ++++ Resources/config/services.yml | 7 +-- Routing/RoutesLoader.php | 52 -------------------- 3 files changed, 10 insertions(+), 58 deletions(-) delete mode 100644 Routing/RoutesLoader.php diff --git a/DependencyInjection/ChillPersonExtension.php b/DependencyInjection/ChillPersonExtension.php index 848db5342..1dafadcd0 100644 --- a/DependencyInjection/ChillPersonExtension.php +++ b/DependencyInjection/ChillPersonExtension.php @@ -61,5 +61,14 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac array('bundles' => array('ChillPersonBundle'))); $this-> declarePersonAsCustomizable($container); + + //declare routes for person bundle + $container->prependExtensionConfig('chill_main', array( + 'routing' => array( + 'resources' => array( + '@ChillPersonBundle/Resources/config/routing.yml' + ) + ) + )); } } diff --git a/Resources/config/services.yml b/Resources/config/services.yml index 22e13c32f..9cbcfad18 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -1,12 +1,7 @@ parameters: # cl_chill_person.example.class: Chill\PersonBundle\Example -services: - chill.person.routing_loader: - class: Chill\PersonBundle\Routing\RoutesLoader - tags: - - { name: routing.loader } - +services: chill.person.accompanying_period_closing_motive: class: Chill\PersonBundle\Form\Type\ClosingMotiveType scope: request diff --git a/Routing/RoutesLoader.php b/Routing/RoutesLoader.php deleted file mode 100644 index 97a285bfe..000000000 --- a/Routing/RoutesLoader.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -namespace Chill\PersonBundle\Routing; - -use Symfony\Component\Config\Loader\Loader; -use Symfony\Component\Routing\RouteCollection; - -/** - * Load routes automatically - * - * @author Julien Fastré - */ -class RoutesLoader extends Loader -{ - - public function load($resource, $type = null) - { - $collection = new RouteCollection(); - - $resource = '@ChillPersonBundle/Resources/config/routing.yml'; - $type = 'yaml'; - - $importedRoutes = $this->import($resource, $type); - - $collection->addCollection($importedRoutes); - - return $collection; - } - - public function supports($resource, $type = null) - { - return 'chill_routes_person' === $type; - } -}