magento / meta-for-magento2

39 stars 23 forks source link

DI Compile fails when MSI extensions removed #14

Open ihor-sviziev opened 1 year ago

ihor-sviziev commented 1 year ago

It looks like there was a trial to fix compatibility issues when MSI modules are disabled in https://github.com/magento/meta-for-magento2/commit/b1000797c59af958b1069a6192013fe4f5db5b05, but it still not working when MSI modules are not present at all (e.g. removed by yireo/magento2-replace-inventory` extension).

Looks like related to:

Note: as a temporary workaround I had to remove the constructor for the \Meta\Catalog\Model\Product\Feed\Builder\MultiSourceInventory class and DI compile started working, but it doesn't look good option, and it requires patching the extension

Preconditions (*)

  1. Magento 2.4.5-p3
  2. Installed yireo/magento2-replace-inventory extension to remove the Multi Stock Inventory feature
  3. Meta for magento2 extension version 1.1.1
  4. php 8.1

Steps to reproduce (*)

  1. Install meta for magento2 extension version 1.1.1
  2. run php bin/magento setup:di:compile

Expected result (*)

  1. DI Compile should complete successfully

Actual result (*)

  1. DI Compile fails with an error:

    
    $ php bin/magento setup:di:compile -vvv
    Compilation was started.
    Area configuration aggregation... 5/9 [===============>------------]  55% 16 secs 438.0 MiB
    In ClassReader.php line 57:
    
    [ReflectionException]                                                                                                                                                                                   
    Impossible to process constructor argument Parameter #0 [ <required> Magento\InventorySalesApi\Api\IsProductSalableInterface $isProductSalableInterface ] of Meta\Catalog\Model\Product\Feed\Builder\M  
    ultiSourceInventory class                                                                                                                                                                               

Exception trace: at /var/www/html/vendor/magento/framework/Code/Reader/ClassReader.php:57 Magento\Framework\Code\Reader\ClassReader->getConstructor() at /var/www/html/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassReaderDecorator.php:35 Magento\Setup\Module\Di\Code\Reader\ClassReaderDecorator->getConstructor() at /var/www/html/setup/src/Magento/Setup/Module/Di/Code/Reader/Decorator/Area.php:53 Magento\Setup\Module\Di\Code\Reader\Decorator\Area->getList() at /var/www/html/setup/src/Magento/Setup/Module/Di/App/Task/Operation/Area.php:116 Magento\Setup\Module\Di\App\Task\Operation\Area->getDefinitionsCollection() at /var/www/html/setup/src/Magento/Setup/Module/Di/App/Task/Operation/Area.php:87 Magento\Setup\Module\Di\App\Task\Operation\Area->doOperation() at /var/www/html/setup/src/Magento/Setup/Module/Di/App/Task/Manager.php:56 Magento\Setup\Module\Di\App\Task\Manager->process() at /var/www/html/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php:216 Magento\Setup\Console\Command\DiCompileCommand->execute() at /var/www/html/vendor/symfony/console/Command/Command.php:255 Symfony\Component\Console\Command\Command->run() at /var/www/html/vendor/symfony/console/Application.php:1021 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/console/Application.php:275 Symfony\Component\Console\Application->doRun() at /var/www/html/vendor/magento/framework/Console/Cli.php:116 Magento\Framework\Console\Cli->doRun() at /var/www/html/vendor/symfony/console/Application.php:149 Symfony\Component\Console\Application->run() at /var/www/html/bin/magento:23

In GetParameterClassTrait.php line 34:

[ReflectionException (-1)]
Class "Magento\InventorySalesApi\Api\IsProductSalableInterface" does not exist

Exception trace: at /var/www/html/vendor/magento/framework/GetParameterClassTrait.php:34 ReflectionClass->__construct() at /var/www/html/vendor/magento/framework/GetParameterClassTrait.php:34 Magento\Framework\Code\Reader\ClassReader->getParameterClass() at /var/www/html/vendor/magento/framework/Code/Reader/ClassReader.php:42 Magento\Framework\Code\Reader\ClassReader->getConstructor() at /var/www/html/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassReaderDecorator.php:35 Magento\Setup\Module\Di\Code\Reader\ClassReaderDecorator->getConstructor() at /var/www/html/setup/src/Magento/Setup/Module/Di/Code/Reader/Decorator/Area.php:53 Magento\Setup\Module\Di\Code\Reader\Decorator\Area->getList() at /var/www/html/setup/src/Magento/Setup/Module/Di/App/Task/Operation/Area.php:116 Magento\Setup\Module\Di\App\Task\Operation\Area->getDefinitionsCollection() at /var/www/html/setup/src/Magento/Setup/Module/Di/App/Task/Operation/Area.php:87 Magento\Setup\Module\Di\App\Task\Operation\Area->doOperation() at /var/www/html/setup/src/Magento/Setup/Module/Di/App/Task/Manager.php:56 Magento\Setup\Module\Di\App\Task\Manager->process() at /var/www/html/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php:216 Magento\Setup\Console\Command\DiCompileCommand->execute() at /var/www/html/vendor/symfony/console/Command/Command.php:255 Symfony\Component\Console\Command\Command->run() at /var/www/html/vendor/symfony/console/Application.php:1021 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/console/Application.php:275 Symfony\Component\Console\Application->doRun() at /var/www/html/vendor/magento/framework/Console/Cli.php:116 Magento\Framework\Console\Cli->doRun() at /var/www/html/vendor/symfony/console/Application.php:149 Symfony\Component\Console\Application->run() at /var/www/html/bin/magento:23

setup:di:compile

ihor-sviziev commented 1 year ago

@zlik @omiroshnichenko could you please take a look?

zlik commented 1 year ago

@zlik @omiroshnichenko could you please take a look?

thanks for reporting @ihor-sviziev, will do!

mageprashant commented 1 year ago

@zlik Any update on this?