Hello,
I try to migrate old project to Phalcon4, but i am stuck at volt service. Here is my code in Module.php:
$di->set('view', function () use ($config) {
$view = new View();
$view->setViewsDir($config->modules->{$config->module}->dir.'views/');
$view->setLayoutsDir('_layouts/');
$view->registerEngines([
'.volt' => 'voltService'
]);
$view->registerEngines([
'.volt' => function (\Phalcon\Mvc\ViewBaseInterface $view, \Phalcon\Di\DiInterface $di) use ($config, $folder) {
$volt = new \Phalcon\Mvc\View\Engine\Volt($view, $di);
$volt->setOptions([
'always' => $config->development,
'path' => $config->dirs->cache . 'volt/',
'separator' => '_'
]);
// Custom filters
$compiler = $volt->getCompiler();
return $volt;
}
]);
return $view;
}, true);
And the error is:
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Modules\Admin\Module::Modules\Admin\{closure}(), 1 passed and exactly 2 expected in D:\www\drooble.v3-back\modules\admin\Module.php on line 60
The line 60 is where '.volt' located- so for some reason, second parametter is missing or something. If i remove \Phalcon\Di\DiInterface $di
from the function - volt was started, but give me error about session (it is not accessible).
Some ideas?