mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
add dependency injection / load routes
This commit is contained in:
parent
5ccafcb73f
commit
8a9a63905e
@ -5,6 +5,44 @@
|
|||||||
Useful snippets
|
Useful snippets
|
||||||
###############
|
###############
|
||||||
|
|
||||||
|
Dependency Injection
|
||||||
|
********************
|
||||||
|
|
||||||
|
Configure route automatically
|
||||||
|
=============================
|
||||||
|
|
||||||
|
Add the route for the current bundle automatically on the main app.
|
||||||
|
|
||||||
|
.. code-block:: php
|
||||||
|
|
||||||
|
namespace Chill\MyBundle\DependencyInjection;
|
||||||
|
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
|
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
||||||
|
|
||||||
|
|
||||||
|
class ChillMyExtension extends Extension implements PrependExtensionInterface
|
||||||
|
{
|
||||||
|
// ...
|
||||||
|
|
||||||
|
public function prepend(ContainerBuilder $container)
|
||||||
|
{
|
||||||
|
$this->prependRoutes($container);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prependRoutes(ContainerBuilder $container)
|
||||||
|
{
|
||||||
|
//add routes for custom bundle
|
||||||
|
$container->prependExtensionConfig('chill_main', array(
|
||||||
|
'routing' => array(
|
||||||
|
'resources' => array(
|
||||||
|
'@ChillMyBundle/Resources/config/routing.yml'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Security
|
Security
|
||||||
********
|
********
|
||||||
|
Loading…
x
Reference in New Issue
Block a user