Shopsys: Parameters should not be in services.yml

Created on 28 Apr 2019  路  4Comments  路  Source: shopsys/shopsys

What is happening

In frameworkBundle there are parameters in services.yml file. It's really confusing and bad practice. Someone can simply miss that, because programmers will be not searching parameters in services.yml.

Expected result


In frameworkBundle could be parameters_common.yml file, where will be default parameters (e.g. shopsys.admin_locale) and parameters_common.yml in project-base should be cleaned.

Most helpful comment

Of course it can be placed in services.yml. Symfony in that docs shows you how to work with parameters. That doesn't mean it's best practice. But for me it's bad practice, because you are mixing places where can you find parameters.

Just look to project base. What if i want to change admin locale. I look to config.yml then parameters.yml or parameters_common.yml can find nothing about that parameter. So i look to framework package and there is nothing like parameters_common.yml so I need to read documentation, because i'm not able to find parameters that can be overwritten.

So after what I wrote it might not be the best idea. Maybe we should create some config like shopsys.yml where that parameters should be stored.

All 4 comments

Hi, why is this a bad practice? It is used this way in Symfony docs - https://symfony.com/doc/current/service_container/parameters.html

Of course it can be placed in services.yml. Symfony in that docs shows you how to work with parameters. That doesn't mean it's best practice. But for me it's bad practice, because you are mixing places where can you find parameters.

Just look to project base. What if i want to change admin locale. I look to config.yml then parameters.yml or parameters_common.yml can find nothing about that parameter. So i look to framework package and there is nothing like parameters_common.yml so I need to read documentation, because i'm not able to find parameters that can be overwritten.

So after what I wrote it might not be the best idea. Maybe we should create some config like shopsys.yml where that parameters should be stored.

And thanks for the answer, but it would be nice if you answer to the whole issue.

And thanks for the answer, but it would be nice if you answer to the whole issue.

Hi, I am sorry but I do not have an answer to the whole issue at the moment, I was just curious about the one particular thing. Thanks for clarifying this.

We will address this issue once it gets high enough in the priorities list (it needs more upvotes at the moment :wink:)

Was this page helpful?
0 / 5 - 0 ratings