Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Symfony 3.2.1 FOSUserBundle模板作为子模板_Symfony_Fosuserbundle - Fatal编程技术网

Symfony 3.2.1 FOSUserBundle模板作为子模板

Symfony 3.2.1 FOSUserBundle模板作为子模板,symfony,fosuserbundle,Symfony,Fosuserbundle,我是symfony的新手,我正在尝试作为孩子覆盖FOSUserBundle模板。复制到src/Resources/FOSUserBundle/views是可行的,但希望通过子捆绑包实现这一点 我创建了ser/UserBundle/UserBundle.php <?php namespace UserBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; class UserBundle extends Bundle {

我是symfony的新手,我正在尝试作为孩子覆盖FOSUserBundle模板。复制到src/Resources/FOSUserBundle/views是可行的,但希望通过子捆绑包实现这一点

我创建了ser/UserBundle/UserBundle.php

<?php

namespace UserBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class UserBundle extends Bundle
{
        public function getParent()
    {
        return 'FOSUserBundle';
    }

}
但这并不是:/ 剖析者说:

Rendering Call Graph

main 4.04ms/100%
└ @FOSUser/Security/login.html.twig 1.78ms/44%
│ └ @FOSUser/layout.html.twig 1.69ms/42%
│   └ @FOSUser/Security/login.html.twig::block(fos_user_content)
│     └ @FOSUser/Security/login_content.html.twig
└ @WebProfiler/Profiler/toolbar_js.html.twig 2.26ms/56%
  └ @WebProfiler/Profiler/base_js.html.twig
我这样做是根据,但这段视频是关于symfony 2.0的,我尝试使用symfony 3.2。Symfony3中的儿童捆绑包是否发生了变化?
我做错了什么?

您是否在
AppKernel
类中添加了您的子捆绑包?是的,这是首先添加的。我安装了带有FOS 2.0的Symfony 2.8,同样的效果是,我的捆绑包中没有呈现布局。但后来我安装了Symfony 2.8和FOS 1.3,我感到惊讶,它可以正常工作,而且是从我的包中呈现的。但是为什么v2.0中没有呢?我已经找到了这种行为的原因:非常感谢。上次更新后,我遇到了相同的问题:(
{% extends '::base.html.twig' %}
{% block title %}Demo Application{% endblock %}

{% block body %}
    {% block fos_user_content %}{% endblock %}
    Ala ma kota
{% endblock %}
Rendering Call Graph

main 4.04ms/100%
└ @FOSUser/Security/login.html.twig 1.78ms/44%
│ └ @FOSUser/layout.html.twig 1.69ms/42%
│   └ @FOSUser/Security/login.html.twig::block(fos_user_content)
│     └ @FOSUser/Security/login_content.html.twig
└ @WebProfiler/Profiler/toolbar_js.html.twig 2.26ms/56%
  └ @WebProfiler/Profiler/base_js.html.twig