问题描述
我是 Symfony2 的新手,我刚刚将它与 fosUserBUndle 1.3.3、Sonata Admin BUndle 和 Sonata User BUndle 一起安装.现在我收到一个我无法解决的错误.
I'm new to Symfony2 and I just installed it along with fosUserBUndle 1.3.3, Sonata Admin BUndle, and Sonata User BUndle. Now I get an error that I cannot resolve.
这是我的错误:
(url localhost:8000/profile/) :
Method "currentAncestor" for object "Knp\Menu\MenuItem" does not exist in
SonataBlockBundle:Block:block_side_menu_template.html.twig at line 29
我能够成功登录,但登录后出现此错误.任何帮助将不胜感激.
I am able to login succesfully, but I get this error after login.Any help would be greatly appreciated.
谢谢
推荐答案
open file block_side_menu_template.html.twig at/var/www/html/MySymProject/vendor/sonata-project/block-bundle/Resources/views/Block/block_side_menu_template.html.twig
open file block_side_menu_template.html.twig at /var/www/html/MySymProject/vendor/sonata-project/block-bundle/Resources/views/Block/block_side_menu_template.html.twig
看第 22 行:
{%- if item.current %}
{%- set classes = classes|merge([options.currentClass]) %}
{%- elseif item.currentAncestor %}
{%- set classes = classes|merge([options.ancestorClass]) %}
{%- endif %}
编辑为:
{%- if matcher.isCurrent(item) %}
{%- set classes = classes|merge([options.currentClass]) %}
{%- elseif matcher.isAncestor(item, options.depth) %}
{%- set classes = classes|merge([options.ancestorClass]) %}
{%- endif %}
您可以访问以下链接找到答案:
you can visit this link below to find the answer :
https://gist.github.com/mrflory/2278437#file-knp_menu-html-twig-L22
这篇关于方法“currentAncestor"用于对象“Knp\Menu\MenuItem"在奏鸣曲中不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!