Overriding templates using "getParent()" doesn't seem to work

fosuserbundle, symfony, twig

Solution

Have you enabled your bundles in the kernel?

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new FOS\UserBundle\FOSUserBundle(),
        new Monse\UserBundle\UserBundle(),
    );
}

EDIT : You could rename your bundle MonseUserBundle to be able to distinguish the parent FOSUserBundle from the bundle that overrides it:

<?php
//src\Monse\UserBundle\MonseUserBundle.php

namespace Monse\UserBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class MonseUserBundle extends Bundle{

    public function getParent(){

        return 'FOSUserBundle';
        }
    }

And now use this:

<?php
    // app/AppKernel.php

    public function registerBundles()
    {
        $bundles = array(
            // ...
            new FOS\UserBundle\FOSUserBundle(),
            new Monse\UserBundle\MonseUserBundle(),
        );
    }

Problem

I'm new to Symfony2 and i'm following the tutorial on YouTube Tutorial for the Symfony FOSUserBundle (FTW!). Around min 7.40 or so, it says to add a method called getParent(), in my case ``` <?php //src\Monse\UserBundle\UserBundle.php namespace Monse\UserBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; class UserBundle extends Bundle{ public function getParent(){ return 'FOSUserBundle'; } } ``` my layout.html.twig looks like this ``` {# src\Monse\UserBundle\Resources\views\layout.html.twig #} {% extends '::base.html.twig' %} {% block body %} {{block('fos_user_content')}} {% endblock %} ``` sadly, it doesn't work, and i've got no idea what i'm doing wrong. Thank you for your help

Original source