From 9e65354cfc8e1e8237595ab6eb0d0cef955e0a81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 7 Nov 2014 11:47:45 +0100 Subject: [PATCH] add routing information to person bundl --- CLChillPersonBundle.php | 9 ---- .../CLChillPersonExtension.php | 31 ----------- Resources/config/services.yml | 7 +-- Routing/RoutesLoader.php | 52 +++++++++++++++++++ composer.json | 3 +- 5 files changed, 58 insertions(+), 44 deletions(-) delete mode 100644 CLChillPersonBundle.php delete mode 100644 DependencyInjection/CLChillPersonExtension.php create mode 100644 Routing/RoutesLoader.php diff --git a/CLChillPersonBundle.php b/CLChillPersonBundle.php deleted file mode 100644 index 847e46e3b..000000000 --- a/CLChillPersonBundle.php +++ /dev/null @@ -1,9 +0,0 @@ -processConfiguration($configuration, $configs); - - $container->setParameter('cl_chill_person.search.use_double_metaphone', - $config['search']['use_double_metaphone']); - - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); - $loader->load('services.yml'); - } -} diff --git a/Resources/config/services.yml b/Resources/config/services.yml index f0c0a1579..7896b62a0 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -2,6 +2,7 @@ parameters: # cl_chill_person.example.class: Chill\PersonBundle\Example services: -# cl_chill_person.example: -# class: %cl_chill_person.example.class% -# arguments: [@service_id, "plain_value", %parameter%] + chill.person.routing_loader: + class: Chill\PersonBundle\Routing\RoutesLoader + tags: + - { name: routing.loader } diff --git a/Routing/RoutesLoader.php b/Routing/RoutesLoader.php new file mode 100644 index 000000000..97a285bfe --- /dev/null +++ b/Routing/RoutesLoader.php @@ -0,0 +1,52 @@ + + * + * 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; + } +} diff --git a/composer.json b/composer.json index 96ab3e76c..969cdffbc 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,8 @@ "doctrine/orm": "2.5.*@dev", "doctrine/common": "2.4.*@dev", "doctrine/doctrine-bundle": "~1.2@dev", - "chill-project/main": "*@dev" + "chill-project/main": "*@dev", + "chill-project/custom-fields": "*@dev" }, "require-dev": { "symfony/dom-crawler": "2.5",