mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
add routing information to person bundl
This commit is contained in:
parent
f1ac36510a
commit
9e65354cfc
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle;
|
||||
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
|
||||
class ChillPersonBundle extends Bundle
|
||||
{
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
use Symfony\Component\DependencyInjection\Loader;
|
||||
|
||||
/**
|
||||
* This is the class that loads and manages your bundle configuration
|
||||
*
|
||||
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
|
||||
*/
|
||||
class CLChillPersonExtension extends Extension
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$configuration = new Configuration();
|
||||
$config = $this->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');
|
||||
}
|
||||
}
|
@ -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 }
|
||||
|
52
Routing/RoutesLoader.php
Normal file
52
Routing/RoutesLoader.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user