magento2-phpstorm-plugin icon indicating copy to clipboard operation
magento2-phpstorm-plugin copied to clipboard

[Generation] Create configuration path constant and method generator(s)

Open bohdan-harniuk opened this issue 3 years ago • 1 comments

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

bohdan-harniuk avatar Sep 07 '22 14:09 bohdan-harniuk

Hi @bohdan-harniuk. Thank you for your report. To speed up processing of this issue, make sure that you provided sufficient information.

Add a comment to assign the issue: @magento I am working on this


m2-assistant[bot] avatar Sep 07 '22 14:09 m2-assistant[bot]