Surcharger un bundle Symfony

mai 31, 2017 5:00 Publié par Laissez vos commentaires

Hello!

Dans ce mini tuto nous allons apprendre un surcharger un bundle symfony.
Nous utiliserons donc 2 bundle, AppParentBundle et AppChildBundle.

Dans le AppChildBundle.php :

<?php

namespace App\ChildBundle;
 use Symfony\Component\HttpKernel\Bundle\Bundle;
 class AppChildBundle extends Bundle

{
 public function getParent()
 {
 return 'AppParentBundle';
 }
 }

C’est à présent dans la configuration des routes qu’il convient d’être rigoureux

Fichier app/routing.yml

app_parent: 

    resource: "../../src/App/ParentBundle/Controller/"

    type: annotation


    prefix: /blabla

Fichier routing.yml du bundle enfant

app_child:

    resource: "@AppChildBundle/Controller/"

    type: annotation


    prefix: /

Terminé 🙂

 

 

 

Classés dans :

Cet article a été écrit par admin

Laisser un commentaire