<table role="table">
<thead>
<tr>
<th>Q</th>
<th>A</th>
</tr>
</thead>
<tbody>
<tr>
<td>Bug report?</td>
<td>yes</td>
</tr>
<tr>
<td>Feature request?</td>
<td>no</td>
</tr>
<tr>
<td>BC Break report?</td>
<td>yes</td>
</tr>
<tr>
<td>Symfony version</td>
<td>v3.2.4</td>
</tr>
</tbody>
</table>
<p dir="auto">After update to v3.2.4 the inheritance of templates from parent bundle does not work. Create a loop and the application crash.</p>
<p dir="auto">e.g.</p>
<p dir="auto">I have a bundle called AdminBundle, with</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="  public function getParent()
    {
        return 'SonataAdminBundle';
    }"><pre class="notranslate">  <span class="pl-k">public</span> <span class="pl-k">function</span> <span class="pl-en">getParent</span>()
    {
        <span class="pl-k">return</span> <span class="pl-s">'SonataAdminBundle'</span>;
    }</pre></div>
<p dir="auto">and override some templates:</p>
<p dir="auto"><code class="notranslate">delete.html.twig:</code></p>
<div class="highlight highlight-text-html-django notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{% extends '@SonataAdmin/CRUD/delete.html.twig' %}"><pre class="notranslate"><span class="pl-e">{%</span> <span class="pl-k">extends</span> <span class="pl-s">'@SonataAdmin/CRUD/delete.html.twig'</span> <span class="pl-e">%}</span></pre></div>
<p dir="auto">The above code works fine before the update, with: "version": "v3.2.1", but not with current version.</p>
<p dir="auto">This feature has been asked by lots and lots of users in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="105790408" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/15755" data-hovercard-type="issue" data-hovercard-url="/symfony/symfony/issues/15755/hovercard" href="https://github.com/symfony/symfony/issues/15755">#15755</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="122789316" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/17054" data-hovercard-type="issue" data-hovercard-url="/symfony/symfony/issues/17054/hovercard" href="https://github.com/symfony/symfony/issues/17054">#17054</a> and <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="127084985" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/17407" data-hovercard-type="issue" data-hovercard-url="/symfony/symfony/issues/17407/hovercard" href="https://github.com/symfony/symfony/issues/17407">#17407</a>.</p>
<h3 dir="auto">Problem</h3>
<ol dir="auto">
<li>You have installed <code class="notranslate">MyBundle</code> which contains this template:</li>
</ol>
<div class="highlight highlight-text-html-twig notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{# MyBundle/Resources/views/base.html.twig #}
{% block title '...' %}

{% block content %}
    {# a lot of contents here #}
{% endblock %}"><pre class="notranslate"><span class="pl-c"><span class="pl-c">{#</span> MyBundle/Resources/views/base.html.twig <span class="pl-c">#}</span></span>
{% <span class="pl-k">block</span> <span class="pl-smi">title</span> <span class="pl-s"><span class="pl-pds">'</span>...<span class="pl-pds">'</span></span> %}

{% <span class="pl-k">block</span> <span class="pl-smi">content</span> %}
    <span class="pl-c"><span class="pl-c">{#</span> a lot of contents here <span class="pl-c">#}</span></span>
{% <span class="pl-k">endblock</span> %}</pre></div>
<ol start="2" dir="auto">
<li>
<p dir="auto">You override that template in your app by creating <code class="notranslate">app/Resources/MyBundle/views/base.html.twig</code>.</p>
</li>
<li>
<p dir="auto">In your own template, you want to override just the <code class="notranslate">title</code> block and reuse the original <code class="notranslate">content</code> block.</p>
</li>
</ol>
<div class="highlight highlight-text-html-twig notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{# app/Resources/MyBundle/views/base.html.twig #}
{% extends 'MyBundle::base.html.twig' %}

{% block title 'New title' %}"><pre class="notranslate"><span class="pl-c"><span class="pl-c">{#</span> app/Resources/MyBundle/views/base.html.twig <span class="pl-c">#}</span></span>
{% <span class="pl-k">extends</span> <span class="pl-s"><span class="pl-pds">'</span>MyBundle::base.html.twig<span class="pl-pds">'</span></span> %}

{% <span class="pl-k">block</span> <span class="pl-smi">title</span> <span class="pl-s"><span class="pl-pds">'</span>New title<span class="pl-pds">'</span></span> %}</pre></div>
<p dir="auto"><strong>This won't work and Symfony will show a <em>"reached nested level"</em> error.</strong> The only current solution is to copy+paste the entire original template (and keep it in sync forever if the bundle changes it).</p>
<h3 dir="auto">Solution</h3>
<p dir="auto">People asking for this feature suggest to add a new notation to tell Twig/Symfony that you want to override the original template, not your copy:</p>
<div class="highlight highlight-text-html-twig notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{# app/Resources/MyBundle/views/base.html.twig #}
{% extends '!MyBundle::base.html.twig' %}

{% block title 'New title' %}"><pre class="notranslate"><span class="pl-c"><span class="pl-c">{#</span> app/Resources/MyBundle/views/base.html.twig <span class="pl-c">#}</span></span>
{% <span class="pl-k">extends</span> <span class="pl-s"><span class="pl-pds">'</span>!MyBundle::base.html.twig<span class="pl-pds">'</span></span> %}

{% <span class="pl-k">block</span> <span class="pl-smi">title</span> <span class="pl-s"><span class="pl-pds">'</span>New title<span class="pl-pds">'</span></span> %}</pre></div>
<p dir="auto">Some people (e.g. <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jakzal/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/jakzal">@jakzal</a>) don't like the new notation. The problem is that <code class="notranslate">!</code> always mean "not", so it can be read as <em>"don't extend ..."</em>.</p>
<p dir="auto">Since Twig prefers expressive syntax, maybe we could use a word to enable the special <code class="notranslate">extends</code> behavior?</p>
<div class="highlight highlight-text-html-twig notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{# app/Resources/MyBundle/views/base.html.twig #}
{% extends original 'MyBundle::base.html.twig' %}

{% block title 'New title' %}"><pre class="notranslate"><span class="pl-c"><span class="pl-c">{#</span> app/Resources/MyBundle/views/base.html.twig <span class="pl-c">#}</span></span>
{% <span class="pl-k">extends</span> <span class="pl-smi">original</span> <span class="pl-s"><span class="pl-pds">'</span>MyBundle::base.html.twig<span class="pl-pds">'</span></span> %}

{% <span class="pl-k">block</span> <span class="pl-smi">title</span> <span class="pl-s"><span class="pl-pds">'</span>New title<span class="pl-pds">'</span></span> %}</pre></div>
<p dir="auto">Comments? Thoughts? Better ideas? Thanks!</p>