Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

How To: What Replaces Mage::getConfig() in Magento 2? #453

@astorm

Description

@astorm

Essentially reopening this -- I can't see the internal ticket so I'm not sure of the rational, but maybe if the same questions were cast differently the real need for a "how to" might be clearer.

Magento 1 has/had a global configuration tree, built from merging the XML configuration of all modules. This is a common pattern in module oriented systems.

The configuration tree was accessible via code that looked something like this.

Mage::getConfig()->getNode('path/to/value');

i.e. Module developers could examine the merged tree and take programatic action based on the merged values. This was/is a very common module development task.

Without clear guidance from the core Magento team, developers are in the dark on how to access configuration values from Magento 2's merged configuration trees. This leaves developers migrating a Magento 1 module to Magento 2 without a clear path forward. Without that clear, official, "@api blessed" path forward, each individual developer/team will come up with their own inconsistent, fragile way of reading the merged configuration trees. This will either tie the hands of the core development team going forward, or break merchant systems that use these modules.

If third party developers are expected to work with the system they need this guidance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions