2

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.

Here is my error:

(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.

Thanks

ORION
  • 2,374
  • 2
  • 22
  • 31
Yusuf Ibrahim
  • 1,591
  • 5
  • 21
  • 46

1 Answers1

6

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

look at line 22 :

{%- if item.current %}
{%- set classes = classes|merge([options.currentClass]) %}
{%- elseif item.currentAncestor %}
{%- set classes = classes|merge([options.ancestorClass]) %}
{%- endif %}

Edit to :

{%- 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

Yusuf Ibrahim
  • 1,591
  • 5
  • 21
  • 46
  • 1
    or change knp-menu-bundle version to v2.0.0, officially sonataUserBUndle (dev-master) require 1.1.*, but sonataUserBUndle 1.1.* will not work with symfony 2.4 – Yusuf Ibrahim Sep 16 '14 at 04:21