mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
loads routes automatically
move routes to config.yml, loaded by prepending configuration refs #273
This commit is contained in:
parent
6c515342d7
commit
e9be284c03
@ -61,5 +61,14 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
|||||||
array('bundles' => array('ChillPersonBundle')));
|
array('bundles' => array('ChillPersonBundle')));
|
||||||
|
|
||||||
$this-> declarePersonAsCustomizable($container);
|
$this-> declarePersonAsCustomizable($container);
|
||||||
|
|
||||||
|
//declare routes for person bundle
|
||||||
|
$container->prependExtensionConfig('chill_main', array(
|
||||||
|
'routing' => array(
|
||||||
|
'resources' => array(
|
||||||
|
'@ChillPersonBundle/Resources/config/routing.yml'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
parameters:
|
parameters:
|
||||||
# cl_chill_person.example.class: Chill\PersonBundle\Example
|
# cl_chill_person.example.class: Chill\PersonBundle\Example
|
||||||
|
|
||||||
services:
|
services:
|
||||||
chill.person.routing_loader:
|
|
||||||
class: Chill\PersonBundle\Routing\RoutesLoader
|
|
||||||
tags:
|
|
||||||
- { name: routing.loader }
|
|
||||||
|
|
||||||
chill.person.accompanying_period_closing_motive:
|
chill.person.accompanying_period_closing_motive:
|
||||||
class: Chill\PersonBundle\Form\Type\ClosingMotiveType
|
class: Chill\PersonBundle\Form\Type\ClosingMotiveType
|
||||||
scope: request
|
scope: request
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
|
||||||
*
|
|
||||||
* 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 <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Chill\PersonBundle\Routing;
|
|
||||||
|
|
||||||
use Symfony\Component\Config\Loader\Loader;
|
|
||||||
use Symfony\Component\Routing\RouteCollection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load routes automatically
|
|
||||||
*
|
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
|
||||||
*/
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user