SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Fatal error: Call to undefined method KnpMenuMenuItem::setCurrentUri()
  2. in ProjectBundle/Menu/Builder.php on line 23
  3.    
  4. <?php
  5. use KnpMenuFactoryInterface;
  6. use SymfonyComponentDependencyInjectionContainerAware;
  7. use SymfonyComponentHttpFoundationRequest;
  8.  
  9. class Builder extends ContainerAware
  10. {
  11.  
  12. private $factory;
  13.  
  14. public function __construct(FactoryInterface $factory)
  15. {
  16.     $this->factory = $factory;
  17. }
  18.  
  19. public function createMenu(Request $request)
  20. {
  21.  
  22.     $menu = $this->factory->createItem('root');
  23.     $menu->setCurrentUri($request->getRequestUri());
  24.  
  25.     $menu->addChild('Home', array('route' => '_home'));
  26.     $menu->addChild('About', array('route' => '_about'));
  27.     $menu->addChild('Bullshit', array('route' => '_bullshit'));
  28.  
  29.     return $menu;
  30. }
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top