Problem with component class

- ruben_cgt
- Member | 6
Hello guys I have a little problem here
I have in the presenter declared the component like this
protected function createComponentNavigation($name)
{
$nav = new Navigation($this, $name);
}
and I am calling the navigation in the .latte like this
{widget navigation}
the class is located in the directory
libs\Nmaster\Navigation.php
and I am getting this error Class ‘Navigation’ not found I don't see where is the error can any of you help me please

- jiri.pudil
- Nette Blogger | 1034
First of all, what version of Nette are you using? In newer versions,
widget macro has been deprecated and it is recommended to use
control instead:
{control navigation}
Also, passing the arguments in constructor is not necessary, so this will suffice:
protected function createComponentNavigation()
{
$nav = new Navigation;
return $nav;
}
Note that the factory method has to return the created component.
As to your actual problem :) I guess it is a namespace issue. If the
Navigation class is in a different namespace from the presenter,
you should add a use statement for it into the presenter.
Otherwise, it might help to clear the cache (contents of
temp/cache/).

- ruben_cgt
- Member | 6
Thank you very much for the rapid feedback Jiri. it seems to be a namespace issue now I have it like this and I have the folder with class under libs/Navigation but still nette can't find the class I also tried erasing the cache
libs/NavigationPlugin
{control navigation}
protected function createComponentNavigation()
{
$nav = new NavigationPlugin/Navigation;
return $nav;
}