1

I am using routing component to load controllers, and if i use just

$routes->add(
    'index',
    new Route('/', array('_controller' => 'indexAction'))
);

my "project" perfectly loads indexAction function, but if i try something like this

$routes->add(
    'index',
    new Route('/', array('_controller' => 'Test::indexAction'))
);

it says

Uncaught exception 'InvalidArgumentException' with message 'Class "Test" does not exist.'

But i cant find where must be my controllers, or how they must be included to be loaded successfully. If this helps, at this moment i am using composer autoload with PSR-0 standart.

Itsmeromka
  • 3,621
  • 9
  • 46
  • 79

2 Answers2

1

Like its said on the Symfony doc about routing, you have to name your controller with this pattern :

     bundle:controller:action
Fidan Hakaj
  • 6,818
  • 3
  • 30
  • 33
0

"Full" path solved the problem

new Route('/', array('_controller' => 'Levelup\\Controller\\Test::indexAction'))

Test::indexAction changed to Levelup\Controller\Test::indexAction

Itsmeromka
  • 3,621
  • 9
  • 46
  • 79