Yes that's what I figured already but i have to admit that I'm pretty lost on the way to achieve this.
First, I wanted to define all this in config/define.php (like i used to do with Aura.View v1) but i couldn't get a way to do it. (No big deal for now, so I go on with my main problem right now : having a view file that is being used and displayed)
Let me explain what I did if you can help me to sort things out.
Right now I have an AbstractController which extends Aura.View.Manager
In this AbstractController I have this :
$view_finder = $this->getViewFinder();
$view_finder->setPaths([
'Fli\Dashboard' => dirname(__DIR__) . '/Views',
]);
Then, I have a DummyController which extends my AbstractController which is a test controller for displaying my first view but...
In my DummyController action, i have this :
print_r($this->getViewFinder()->getPaths());
which displays :
Array ( [\Fli\Dashboard\] => /var/www/fl-dashboard/src/Fli/Dashboard/Views/ )
My file system is ok with this path :
trololo:~# ll /var/www/fl-dashboard/src/Fli/Dashboard/Views/
total 4
-rwxrw---- 1 wwwdev www-data 96 janv. 31 08:53 test.php
after the print_r, i have the following code :
$data = [
'name' => 'Ferrand',
'email' => 'f...@example.com',
];
$output = $this->render($data, 'test'); // i tried test.php too
this results in :
Exception 'Aura\View\Exception\TemplateNotFound' thrown for GET / Params: array ( 'controller' => 'dummy', 'action' => 'main', ) exception 'Aura\View\Exception\TemplateNotFound' with message 'test' in /var/www/fl-dashboard/vendor/aura/view/src/Template.php:56 Stack trace: #0 /var/www/fl-dashboard/vendor/aura/view/src/Template.php(26): Aura\View\Template->convertToClosure('test') #1 /var/www/fl-dashboard/vendor/aura/view/src/Manager.php(164): Aura\View\Template->render('test') #2 /var/www/fl-dashboard/src/Fli/Dashboard/Controller/DummyController.php(38): Aura\View\Manager->render(Array, 'test') #3 [internal function]: Fli\Dashboard\Controller\DummyController->main() #4 /var/www/fl-dashboard/vendor/aura/dispatcher/src/InvokeMethodTrait.php(96): ReflectionMethod->invokeArgs(Object(Fli\Dashboard\Controller\DummyController), Array) #5 /var/www/fl-dashboard/vendor/aura/dispatcher/src/Dispatcher.php(111): Aura\Dispatcher\Dispatcher->invokeMethod(Object(Fli\Dashboard\Controller\DummyController), 'main', Array) #6 /var/www/fl-dashboard/vendor/aura/dispatcher/src/Dispatcher.php(124): Aura\Dispatcher\Dispatcher->dispatch(Object(Fli\Dashboard\Controller\DummyController), Array) #7 /var/www/fl-dashboard/vendor/aura/dispatcher/src/Dispatcher.php(90): Aura\Dispatcher\Dispatcher->dispatch(Object(Aura\Di\LazyNew), Array) #8 /var/www/fl-dashboard/vendor/aura/web-kernel/src/WebKernelDispatcher.php(49): Aura\Dispatcher\Dispatcher->__invoke(Array) #9 /var/www/fl-dashboard/vendor/aura/web-kernel/src/WebKernel.php(45): Aura\Web_Kernel\WebKernelDispatcher->__invoke() #10 /var/www/fl-dashboard/web/index.php(28): Aura\Web_Kernel\WebKernel->__invoke() #11 {main}
Any hint ?
I know Aura.View v2 is still in development but Documentation is a bit straightfoward (only mentionning closures) and even if I read a lot of Aura code, i can't really get exactly why the Finder object can't get my view.
What did I miss ?