SettingsBundle
SettingsBundle copied to clipboard
Rename USER scope to LOCAL
It make no sense anymore to have a User
scope. We should consider renaming it to Local
.
I agree with you about renaming, but Local
isn't a perfect choice, as for me.
Let's think about alternatives: Person
, Identity
, Owner
, Private
, etc
Hm, you might be right. I thought of Local
as contrary to Global
. I don't like a scope name like Person
because it implies that a SettingOwner shoud be a user when it could be any object.
Let's see what the different scope really does:
- All => This setting is applicable to all scopes, but it is really "scope free".
- Global => This setting can not be tied to a
SettingOwner
. - User => This setting must be tied to a
SettingOwner
.
I suggest the follwing change: All => None Global => Public User => Private
Or if you rather prefer: All => None User => Local
I think we should rename User
=> Private
and keep Global
. My concern is that private
and public
are very similar, it seems they are related to the same entity (like methods of a class, etc) but the global scope is totally independent from owner. What do you think?
My concern is that private and public are very similar, it seems they are related to the same entity (like methods of a class, etc)
Okey. Hm, But you do also have a global and local (function) scope of variables.
I feel that the names All (1), Global (2), Private (3) are a bit strange. Since 2 is the opposite to 3 they should be named with words that are generally know as opposites...
Reading futher.. Wikipedia about scopes refers to:
- Expression scope
- Block scope
- Function scope
- File scope
- Module scope
- Global scope
They don't really mention private
.
I can't really make upp my mind. I know that user
is no good. Maybe we should consider something else like: model
, object
or settingOwner
. They make it all clear that the setting must be tied to an object.
Referring to the SettingsOwnerInterface
we could rename private
=> owner
and it will have better match to the meaning.
Final list: ALL
, GLOBAL
, OWNER
What's your point on this, @Nyholm ?
Sure, it makes sense. Let's have GLOBAL
and OWNER
.
I suggest to rename ALL
to NONE
. I believe this is a scope independent setting. Consider the following:
Scope | Settings |
---|---|
ALL | foo |
GLOBAL | bar |
OWNER | baz |
I have declared foo to ALL
. Is that all scopes? Or "all" what? If we want to fetch settings in the OWNER
scope. What should be returned?
- A) baz
- B) baz and foo
Since A is correct it seams weird that foo is in all scopes since it clearly is not in OWNER
... I believe the name ALL
is confusing. I would prefer NONE
.
I think within the scope there should also be a separation on Section
. That way a user can have settings per module.
:+1: Interesting idea! Could you please elaborate this a little bit. Give some use cases and/or examples.
Well, I'm implementing this bundle as a replacement of the CraueConfigBundle because it seems to have more advanced options. My use-case for switching to this bundle is the user scope, I'd like to introduce a setting (internal counter) for a user that keeps track of the number of times it opened a "tour".
Great about the sections in that bundle is that it allows me as an admin/developer to group settings. In the near future this will allow me to visually make tabs of all sections in my backend config for the "global" parameters. By introducing the sections, this allows me to get rid of the "prefixes" in the setting names. You could even think of configuring validation based on these sections.
Another question @Nyholm , does the bundle allow me to edit all global settings without having to define all my current settings in a config file?
So the section is nothing but a label you attach that allows you group settings? That is a feature I also would like to see. I'm sure @dmishh are happy to see a PR. =)
Another question @Nyholm , does the bundle allow me to edit all global settings without having to define all my current settings in a config file?
I'm not too sure what you mean. If I assume that the "current settings" are settings defined in CraueConfigBundle, then no. They store their settings differently. Aslo we need the config of "valid" settings.
Okay, then I'd propose a way to lower the bar for developers to use this bundle. I do not want to define all settings in a yml file, they simply are a way to toggle certain features within my application and I'm the only one that will change them :wink:
I can think of letting them fall under a certain "admin" section, and if only that section has a configuration, that's fine. Ofcourse the settings themselves could override the section configuration. :+1:
they simply are a way to toggle certain features within my application and I'm the only one that will change them
@Rvanlaak certain is key here. You don't have unlimited or random features, do you? In that case, you always can be precise with the features list. Of course, adding all of them to the config file is a bit burdening, but I'm considering it as a good practice.
As for the Settings' sections, we have an issue #3 created already
@Nyholm
NONE
means to me like something is turned off, isn't active, empty, unfulfilled. But the meaning should be: covers all, includes all possible states, gives the ability to use all possible features/options/etc
:+1:
I want use the "User Scope" to save locale (and have setting by locale) I think scope private is better than scope user