From 9e8374bef7c7ac4b41cf50fac7a6f20c54b2219d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 22 Jan 2015 17:19:24 +0100 Subject: [PATCH] define route in chill_main configuration refs #273 --- .../ChillCustomFieldsExtension.php | 9 ++++ Resources/config/services.yml | 5 -- Routing/RoutesLoader.php | 53 ------------------- 3 files changed, 9 insertions(+), 58 deletions(-) delete mode 100644 Routing/RoutesLoader.php diff --git a/DependencyInjection/ChillCustomFieldsExtension.php b/DependencyInjection/ChillCustomFieldsExtension.php index 28e35abd8..3f5a1342c 100644 --- a/DependencyInjection/ChillCustomFieldsExtension.php +++ b/DependencyInjection/ChillCustomFieldsExtension.php @@ -43,5 +43,14 @@ class ChillCustomFieldsExtension extends Extension implements PrependExtensionIn // add form layout to twig resources $twigConfig['form']['resources'][] = 'ChillCustomFieldsBundle:Form:fields.html.twig'; $container->prependExtensionConfig('twig', $twigConfig); + + //add routes for custom bundle + $container->prependExtensionConfig('chill_main', array( + 'routing' => array( + 'resources' => array( + '@ChillCustomFieldsBundle/Resources/config/routing.yml' + ) + ) + )); } } diff --git a/Resources/config/services.yml b/Resources/config/services.yml index 55fd134c7..c483938fd 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -2,11 +2,6 @@ parameters: # cl_custom_fields.example.class: Chill\CustomFieldsBundle\Example services: - chill.custom_fields.routing_loader: - class: Chill\CustomFieldsBundle\Routing\RoutesLoader - tags: - - { name: routing.loader } - chill.custom_field.provider: class: Chill\CustomFieldsBundle\Service\CustomFieldProvider call: diff --git a/Routing/RoutesLoader.php b/Routing/RoutesLoader.php deleted file mode 100644 index d9a8ab035..000000000 --- a/Routing/RoutesLoader.php +++ /dev/null @@ -1,53 +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\CustomFieldsBundle\Routing; - -use Symfony\Component\Config\Loader\LoaderInterface; -use Symfony\Component\Config\Loader\LoaderResolverInterface; -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 = '@ChillCustomFieldsBundle/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' === $type; - } -}