Open
Description
Create a configuration path constant and method generators.
It should be implemented as two different generators.
Input:
- path to field (as for an ex.: b2b/general/enabled)
- scope info (showInDefault="1" showInWebsite="1" showInStore="1")
- flag if scope should be provided (
?int $storeId = null
) - field type (
\Magento\Framework\Data\Form\Element\Factory::$_standardTypes
)
Output:
Generated constant that contains config path, as for an ex.:
private const XML_PATH_TAX_NOTIFICATION_IGNORE_DISCOUNT = 'tax/notification/ignore_discount';
Generated method, as for an example:
/**
* Check if do not show notification about wrong discount settings.
*
* @param null|int $storeId
*
* @return bool
*/
public function isWrongDiscountSettingsIgnored(?int $storeId = null)
{
return $this->scopeConfig->isSetFlag(
self::XML_PATH_TAX_NOTIFICATION_IGNORE_DISCOUNT,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
$storeId
);
}
Acceptance Criteria:
- this generation should be covered by test case.
- no actions should be created (will be done separately)
- consider implementing new architecture ways to create generators (try to not follow current one, maybe we can improve it)
Additional context
Mainline branch: mainline/generate-configuration-model