volt - conflict of variable name and service name
If I have serwis name "xxx" and I declare in view variable "xxx" in *.volt when I write
{{ xxx }}
in variable "xxx" will be service "xxx" not variable.
Is it possible to give any prefix for every service inject to volt?
Or is it possible to change order that if is conflict then in volt exists a variable not a service.
We cannot change the name right now (of services etc.) so there will always be a conflict between a service and a variable with the same name.
Potential solutions:
Instead of using the FactoryDefault DI, you can set your own, and prefix the services with say service*. That however will not work for say modelsMetadata or the db service because those names are required to be as they are.
Use different variable names - prefixed with whatever you want say viewVar*
I am not sure that changing the order will work because we will need to figure out what property (in volt) is a service or not and it will be difficult.
Here https://github.com/phalcon/cphalcon/blob/master/phalcon/Mvc/View/Engine/Volt/Compiler.zep in line 129
if typeof this->container == "object" && this->container->has(variable) {
can be changed order.
Thank you for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please feel free to either reopen this issue or open a new one. We will be more than happy to look at it again! You can read more here: https://blog.phalcon.io/post/github-closing-old-issues