KnpLabs / KnpMenuBundle

Object Oriented menus for your Symfony project.
http://knplabs.com
MIT License
1.4k stars 204 forks source link

ReflectionException: Class Knp\Menu\ItemInterface does not exist #63

Closed kristianawright closed 13 years ago

kristianawright commented 13 years ago

I just upgraded to the latest version of KnpMenuBundle. It's throwing a ReflectionException: Class Knp\Menu\ItemInterface does not exist from line 19 of Knp/Bundle/MenuBundle/DependencyInjection/Compiler/AddTemplatePathPass.php. I tried emptying the cache and reinstalling the vendors, but that didn't fix the problem. What's going on?

stof commented 13 years ago

You need the KnpMenu library

kristianawright commented 13 years ago

Oh, okay. I didn't notice that BC break. Thanks.

ardianys commented 13 years ago

Hi, I'm sorry for commenting on closed thread, but I'm new in symfony2 world, I had setup my Symfony to

'Sonata'        => __DIR__.'/../vendor/bundles',
'Knp'           => __DIR__.'/../vendor/bundles',

and

new Sonata\jQueryBundle\SonatajQueryBundle(),
new Sonata\BluePrintBundle\SonataBluePrintBundle(),
new Sonata\AdminBundle\SonataAdminBundle(),
new Knp\Bundle\MenuBundle\KnpMenuBundle(),

but when I run this command

  php app/console assets:install web --symlink

I got this error

  [ReflectionException]                        
  Class Knp\Menu\ItemInterface does not exist 

But I have this file in

vendor/knp/menu/src/Knp/Menu/ItemInterface.php

Could you explain me how to solve this problem ? Thanks.

kristianawright commented 13 years ago

KnpMenu has its own repository now. Follow the instructions at https://github.com/knplabs/KnpMenuBundle/blob/master/Resources/doc/index.md to get it working. You'll need to register separate namespaces for Knp\Bundle and Knp\Menu.

ardianys commented 13 years ago

Oh Man, thanks for your help.

ghost commented 10 years ago

I'm using Symfony 2.4.1. All dependencies were downloaded today from their github repositories. I have the same issue, and after I configured Sonata Admin Bundle and other dependencies (manually), when I ran the same command it rised the same Exception, so I included this new line:

'Knp\Menu' => array($vendorDir . '/knplabs/knp-menu/src'),//Knp/Menu

in autoload_namespaces.php and the problem persists. Even when the: ItemInterface.php is physically there.

'Knp\Menu' => array($vendorDir . '/knplabs/knp-menu/src'),//Knp/Menu 'Knp\Bundle\MenuBundle' => array($vendorDir . '/knplabs/knp-menu-bundle'),//Knp/Menu/Bundle

Does the adding order matter? Thanks in advance.