cancel
Showing results for 
Search instead for 
Did you mean: 

Config scope naming ambiguity

0 Kudos

Config scope naming ambiguity

Feature request from pantaoran, posted on GitHub Mar 23, 2016

I observe that in app/code/Magento/Store/Model/ScopeInterface.php there are 5 different scope type constants which are ambiguous and probably should be unified.

interface ScopeInterface
{
    /**#@+
     * Scope types
     */
    const SCOPE_STORES = 'stores';

    const SCOPE_WEBSITES = 'websites';

    const SCOPE_STORE   = 'store';
    const SCOPE_GROUP   = 'group';
    const SCOPE_WEBSITE = 'website';
    /**#@-*/
}

Both "store/stores" and "website/websites" exist once in singular and once in plural. It is not clear to the developer in any way which one should be used.

We ran into this problem today in our team, where I wrote code to set some config values, and another team member wrote code to read them, but I used the plural constants and he used the singular ones. We didn't notice the problem for weeks because we always tested with the default config values and didn't bother to set storeview-specific ones, and even when we did, I guess they must use a fall-back to default scope values when the store specific ones are not found.

I searched through the core code for use, and both versions seem to be used, although the singular versions are used much more often. Can we please simplify this important interface to only use one spelling per type?

Or is there a compelling reason to keep both singular and plural for these that I'm not understanding? I feel strange for bringing this up here because I can't possibly be the first person to notice this...

2 Comments
apiuser
New Member

Comment from oserediuk, posted on GitHub Jun 22, 2016

Hello! Please, provide the used version. If the problem is actual for a specific branch, please, specify it and be sure that the latest update was used.

apiuser
New Member

Comment from pantaoran, posted on GitHub Jun 23, 2016

When I opened this issue I was using 2.0.2