-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.0.x] Remove $di being passed in as second parameter into Volt service #11926
Comments
It seems to me this is mainly phalcon/docs issue |
We just need to implemt both behaviours and that's it. |
This comment was marked as abuse.
This comment was marked as abuse.
Could you please explain guys what kind of problem you are discussing |
This comment was marked as abuse.
This comment was marked as abuse.
For me old syntax shouldn't be removed on version 2.x. We could do it on 3.x for me. Further 2.x shouldn't have any code breaking previous 2.x versions. There should be as little as possible changes in api to update to new minor version. We should just deprecate old syntax(just trigger E_DEPRECATED if it's used) but it should work in my opinion as it is. |
This comment was marked as abuse.
This comment was marked as abuse.
Where there is - we just need to use reflection, but should we ? Just if function accept two arguments - trigger deprecated and inform in which version it will be removed. We could in 2.2 maybe beacause we don't follow semver. But i think we always should inform about something before remove it, not everyone will check changelog, github or blog. Some of people will just upgrade and that's it. At least in logs they could see something. |
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
$di->setShared(
'volt',
function (\Phalcon\Mvc\ViewBaseInterface $view, \Phalcon\DiInterface $di = null) {
/** @var \Phalcon\DiInterface $this */
$config = $this->getShared('config');
$volt = new Volt($view, $di ?: $this);
$volt->setOptions(
[
'compiledPath' => $config->application->view->compiledPath,
'compiledSeparator' => $config->application->view->compiledSeparator,
'compiledExtension' => $config->application->view->compiledExtension,
'compileAlways' => (bool) $config->application->debug,
]
);
return $volt;
}
);
$di->setShared(
'view',
function () use () {
/** @var \Phalcon\DiInterface $this */
$config = $this->getShared('config');
$view = new \Phalcon\Mvc\View();
$engines = [
'.volt' => $this->getShared('volt', [$view, $this]),
];
$view->registerEngines($engines);
$view->setViewsDir($config->application->view->viewsDir);
return $view;
}
); |
This comment was marked as abuse.
This comment was marked as abuse.
It can be done in 3.* with keeping BC using reflection but there is no point in this imho. |
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
Closing in favor of #13855. Will revisit if the community votes for it, or in later versions. |
Phalcon 2.1 is binding the service functions to the dependency injector and so the second parameter being passed into the Volt definition is unnecessary.
This would turn the following:
into this:
This would add consistency to the services but would have the downside of breaking existing service definitions.
The text was updated successfully, but these errors were encountered: