-
Notifications
You must be signed in to change notification settings - Fork 112
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
bug: multiple setExtraColumns
calls cause issues with values not being cleared
#175
Comments
Info - anlutro#175
I spent about 7 hours to understand why my settings are not working)) |
setExtraColumns
calls cause issues with values not being cleared
Hi @rshkabko please correct me if I am wrong but from what I can gather you're using This wasn't a use case we had thought about but the following should work: Option 1Force reload after changing the columns. foreach (...) {
Setting::setExtraColumns(['portal_id' => $portal_id]);
Setting::load(true);
...
} Option 2Write your own SettingStore that will cater for this, you can do this by extending the base class of the Option 3Write a PR that resets a |
Option 3 has been mentioned before #32 (comment) Feel free to create a PR or use any other suggested option. |
Hello! |
For example, I have multiple user portals. I use
Setting::setExtraColumns(['portal_id' => $portal_id]);
For example, I want to get (or update) some settings on all portals (or even 2 at once).
\Setting::setExtraColumns(['portal_id' => 15]);
$setting = \Setting::get('EXCHANGE'); // OK, will get portal 15 setting
\Setting::setExtraColumns(['portal_id' => 20]);
$setting = \Setting::get('EXCHANGE'); // BUG, will get portal 15 setting TOO
All because you use here:
public function load($force = false) { if (!$this->loaded || $force) { $this->data = $this->readData(); $this->persistedData = $this->data; $this->data = array_merge($this->updatedData, $this->data); $this->loaded = true; } }
This
if (!$this->loaded || $force) {
Please, optimize or remove it.
I hope you understand)
The text was updated successfully, but these errors were encountered: