EmicoEcommerce / Magento2Tweakwise-archived

Magento 2 module for Tweakwise integration
Other
9 stars 25 forks source link

Add missing magento/framework dependency #191

Closed aadmathijssen closed 2 years ago

aadmathijssen commented 2 years ago

This fixes the following error when running composer install:

PHP Fatal error:  Uncaught Error: Class 'Magento\Framework\Component\ComponentRegistrar' not found in /path/to/EmicoEcommerce/Magento2Tweakwise/vendor/emico/tweakwise-export/registration.php:11
Stack trace:
#0 /path/to/EmicoEcommerce/Magento2Tweakwise/vendor/composer/autoload_real.php(71): require()
#1 /path/to/EmicoEcommerce/Magento2Tweakwise/vendor/composer/autoload_real.php(61): composerRequire58da530b8c249485889ac3c8a0a1c1bd('6b295ea0b2080c1...', '/path/to...')
#2 /path/to/EmicoEcommerce/Magento2Tweakwise/vendor/autoload.php(7): ComposerAutoloaderInit58da530b8c249485889ac3c8a0a1c1bd::getLoader()
#3 /path/to/EmicoEcommerce/Magento2Tweakwise/vendor/phpro/grumphp/bin/grumphp(13): require_once('/path/to...')
#4 /path/to/EmicoEcommerce/Magento2Tweakwise/vendor/phpro/grumphp/bin/grumphp(51): {closure}()
#5 {main}
    thrown in /path/to/EmicoEcommerce/Magento2Tweakwise/vendor/emico/tweakwise-export/registration.php on line 11

This error occurs because the registration.php file is part of the Composer autoload configuration, and this references classes from the magento/framework package.

Hnto commented 2 years ago

@aadmathijssen

We haven't had any complaints regarding this situation. I also couldn't reproduce it.

To help us identify the issue:

aadmathijssen commented 2 years ago

Hi @Hnto,

This issue occurs when running composer install on a standalone clone of the repository, i.e. not in the context of a Magento repository:

$ git clone https://github.com/EmicoEcommerce/Magento2Tweakwise.git
$ cd Magento2Tweakwise
$ composer install

I noticed that I didn't include the full error message, which is the following (notice the last line):

PHP Fatal error:  Uncaught Error: Class 'Magento\Framework\Component\ComponentRegistrar' not found in /path/to/EmicoEcommerce/Magento2Tweakwise/vendor/emico/tweakwise-export/registration.php:11
Stack trace:
#0 /path/to/EmicoEcommerce/Magento2Tweakwise/vendor/composer/autoload_real.php(71): require()
#1 /path/to/EmicoEcommerce/Magento2Tweakwise/vendor/composer/autoload_real.php(61): composerRequire58da530b8c249485889ac3c8a0a1c1bd('6b295ea0b2080c1...', '/path/to...')
#2 /path/to/EmicoEcommerce/Magento2Tweakwise/vendor/autoload.php(7): ComposerAutoloaderInit58da530b8c249485889ac3c8a0a1c1bd::getLoader()
#3 /path/to/EmicoEcommerce/Magento2Tweakwise/vendor/phpro/grumphp/bin/grumphp(13): require_once('/path/to...')
#4 /path/to/EmicoEcommerce/Magento2Tweakwise/vendor/phpro/grumphp/bin/grumphp(51): {closure}()
#5 {main}
    thrown in /path/to/EmicoEcommerce/Magento2Tweakwise/vendor/emico/tweakwise-export/registration.php on line 11
Fatal error:  Uncaught Error: Class 'Magento\Framework\Component\ComponentRegistrar' not found in /path/to/EmicoEcommerce/Magento2Tweakwise/vendor/emico/tweakwise-export/registration.php:11
Stack trace:
#0 /path/to/EmicoEcommerce/Magento2Tweakwise/vendor/composer/autoload_real.php(71): require()
#1 /path/to/EmicoEcommerce/Magento2Tweakwise/vendor/composer/autoload_real.php(61): composerRequire58da530b8c249485889ac3c8a0a1c1bd('6b295ea0b2080c1...', '/path/to...')
#2 /path/to/EmicoEcommerce/Magento2Tweakwise/vendor/autoload.php(7): ComposerAutoloaderInit58da530b8c249485889ac3c8a0a1c1bd::getLoader()
#3 /path/to/EmicoEcommerce/Magento2Tweakwise/vendor/phpro/grumphp/bin/grumphp(13): require_once('/path/to...')
#4 /path/to/EmicoEcommerce/Magento2Tweakwise/vendor/phpro/grumphp/bin/grumphp(51): {closure}()
#5 {main}
    thrown in /path/to/EmicoEcommerce/Magento2Tweakwise/vendor/emico/tweakwise-export/registration.php on line 11
GrumPHP can not sniff your commits! (invalid-exit-code)

I understand that the module is only supposed to function in the context of a Magento repository, however it is convenient to allow quality tooling like GrumPHP te work without the need to embed it in a Magento context.

BTW I am aware that it is better to add a proper version constraint than * for magento/framework, but this is just to get the composer install working. I think it would even be better to add all Magento modules as dependencies that are referenced by the source code, but issue #134 seems a better place to discuss this.

Hnto commented 2 years ago

@aadmathijssen Thanks for your extended reply. Your problem is clear. Would you be ok with closing this issue since resolving issue #134 would also address your problem?

Hnto commented 2 years ago

@aadmathijssen I will be closing this issue due to inactivity