-
Notifications
You must be signed in to change notification settings - Fork 15
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
0011 - Use constants for configuration variables #16
0011 - Use constants for configuration variables #16
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the PR to include examples.
|
||
## Consequences | ||
|
||
What becomes easier : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added 2 drawbacks, couldn't think of more at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.