magento / magento/magento2-phpstorm-plugin

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

Open
#1,163 1 comment 0 reactions 1 assignee Claimed by @bohdan-harniuk View on GitHub
Advanced Configuration Model Generation good first issue Priority: P3
Dominant language
Java
Stars
463
Forks
98
Avg merge
1h 6m
Merged PRs (30d)
3

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.:

```php
private const XML_PATH_TAX_NOTIFICATION_IGNORE_DISCOUNT = 'tax/notification/ignore_discount';
```

Generated method, as for an example:

```php
/**
* 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.