staempfli / magento2-code-generator

Code generator for Magento 2
250 stars 58 forks source link

Undefined Index Notice While Generating Module #23

Closed Partabsaifzakir closed 4 years ago

Partabsaifzakir commented 5 years ago

Why i'm getting this ???

mg2-codegen t:g module

PHP Notice: Undefined index: HOME in C:\Users\S.P Zakir\AppData\Roaming\Composer\vendor\staempfli\universal-code-generator\src\Staempfli\UniversalGenerator\Helper\Files\ApplicationFilesHelper.php on line 58

Notice: Undefined index: HOME in C:\Users\S.P Zakir\AppData\Roaming\Composer\vendor\staempfli\universal-code-generator\src\Staempfli\UniversalGenerator\Helper\Files\ApplicationFilesHelper.php on line 58 Template Generate: module PHP Notice: Undefined index: HOME in C:\Users\S.P Zakir\AppData\Roaming\Composer\vendor\staempfli\universal-code-generator\src\Staempfli\UniversalGenerator\Helper\Files\ApplicationFilesHelper.php on line 58

Notice: Undefined index: HOME in C:\Users\S.P Zakir\AppData\Roaming\Composer\vendor\staempfli\universal-code-generator\src\Staempfli\UniversalGenerator\Helper\Files\ApplicationFilesHelper.php on line 58

piotrkwiecinski commented 5 years ago

From the path it looks like you're on windows.

Current implementation only handles HOME variable in server: https://github.com/staempfli/universal-code-generator/blob/master/src/Staempfli/UniversalGenerator/Helper/Files/ApplicationFilesHelper.php#L56-L59

Composer has it implemented like: https://github.com/composer/composer/blob/master/src/Composer/Util/Platform.php#L48-L64

There may be more issues with support for windows.

If no one grabs it I'll try to PR it at the end of the week.

jalogut commented 4 years ago

Hi @Partabsaifzakir and @piotrkwiecinski

I merged the PR from @piotrkwiecinski and created a new version 1.11.2. Thanks for the contribution and sorry for the delay.