0011 - Use constants for configuration variables#16
0011 - Use constants for configuration variables#16JevgenijVisockij wants to merge 5 commits intoPrestaShop:masterfrom
Conversation
|
ADR added in table https://github.com/PrestaShop/ADR/blob/master/README.md |
|
|
||
| ## Context | ||
|
|
||
| Configuration names in PrestaShop are used as hardcoded strings. It makes it harder to figure out |
There was a problem hiding this comment.
Could you provide a few examples of such configuration names and how they are used in the code ? (just to make it easier for reader to understand the topic, this ADR also serves as documentation for people in the future)
There was a problem hiding this comment.
Updated the PR to include examples.
|
|
||
| ## Consequences | ||
|
|
||
| What becomes easier : |
There was a problem hiding this comment.
To be honest, we must also list the drawbacks 😄 . This means for example we need to require or use the Configuration class everywhere.
There was a problem hiding this comment.
Added 2 drawbacks, couldn't think of more at the moment.
matks
left a comment
There was a problem hiding this comment.
PR looks good to me. Complete. Ready to discuss and vote.
|
@PrestaShop/prestashop-core-developers Can you check this and ask questions if you have? Else we can start the voting phase. |
|
@matks You should ping @PrestaShop/prestashop-maintainers. May we should create a meeting for all ADRs? |
matthieu-rolland
left a comment
There was a problem hiding this comment.
Being working on the configuration forms at the moment, I wholeheartedly agree with this ADR.
About the drawbacks, they are minor in my opinion, this could be implemented progressively.
| PS_SHOP_ENABLE | ||
|
|
||
| It makes it harder to figure out which configurations are available, also leaves possibility for mistyping configuration name without noticing. | ||
|
|
There was a problem hiding this comment.
Also, configuration names don't always match the names of configuration form fields, for example, form field enable_shop is linked to the configuration name PS_SHOP_ENABLE. (and not PS_ENABLE_SHOP as we would intuitively guess).
Using constants would make it less error-prone.
|
I like the idea, I'm not sure if main
I don't think it's that important, I'm thinking aloud :) |
As I said in the PR, I'm like @kpodemski, using ConfigurationCore class isn't the best one (imho). I'm not even sure about the |
|
Hi @PrestaShop/prestashop-maintainers , I'm not sure it's a good idea to keep ADR for months. If it's not relevant, maybe it's time to close it? 🤔 |
|
Yes :( unfortunately ADR are a costly process as it requires time from each maintainer to explore and discuss the topic, so it's hard to be able to get everybody's attention and investment on a single topic. This topic did not make it. |
No description provided.