-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Add @api annotation to the ScopeConfig WriterInterface #14374
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
Conversation
Hi @larsroettig, thank you for the review. |
@magento-engcom-team That link just takes me to the magento user page on github. |
@navarr Because you are already in Magento org :-) maybe we should fix this in automation 🔍 |
Hi @navarr , I see that in namespace |
@sidolov Yes. Our team was writing a log rotator (for the database), where older logs are deleted. To accomplish this, we had two config fields: a start time, and a frequency. These are then compiled into a configuration setting that contains the actual cron format. We needed a method to write to the config during this compilation step. The developer's first go was to use the config Value model and save it - but that's not the Magento way, so we went down the rabbit hole of trying to figure out how we're supposed to save config. The internet likes WriterInterface - but it's not annotated, so I went down the chain of things it does to find something annotated. Unfortunately what we found was The ideal situation is that there is an api annotated interface for setting config. WriterInterface seems like the best choice. |
@navarr I see that it useful for you, thank you for fast response! |
Description
I would like a more official way of writing config that's part of the API.
Currently, You should use
Magento\Config\Model\ResourceModel\Config::saveConfig
- which is @api annotated.That class implements
Magento\Framework\App\Config\ConfigResource\ConfigInterface
(which is not annotated) - and that class is used byMagento\Framework\App\Config\Storage\WriterInterface
(which is not annotated - but I propose to do so here)Contribution checklist