Closed mreishman closed 5 years ago
Have you tried to run setup:di:compile
command with this setup? Because I tried a very similar solution and it seems to not instantiate the classes, just using some static compilation and it fails badly on this constructor.
Yeah, I actually setup a small CI/CD pipeline to run the following commands over on Gitlab.
php bin/magento deploy:mode:set production -s
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
Here's the output I got from the setup:di:compile
php bin/magento setup:di:compile
Compilation was started.
Interception cache generation... 7/7 [=============] 100% 1 min 532.0 MiB
Generated code and dependency injection configuration successfully.
Give us some time to investigate. At the moment I get the following output:
application@58f249bdfb8a:/app$ bin/magento setup:di:compile
Compilation was started.
Interception cache generation... 6/7 [========================>---] 85% 4 mins 290.0 MiBErrors during compilation:
Emartech\Emarsys\Model\ResourceModel\Api\Category
Incompatible argument type: Required type: array. Actual type: \Magento\Catalog\Model\Indexer\Category\Product\Processor; File:
/app/vendor/emartech/emarsys-magento2-extension/Model/ResourceModel/Api/Category.php
Total Errors Count: 1
[Magento\Framework\Validator\Exception]
Error during compilation
setup:di:compile
application@58f249bdfb8a:/app$ bin/magento --version
Magento CLI version 2.2.6
application@58f249bdfb8a:/app$ cd vendor/emartech/emarsys-magento2-extension/
application@58f249bdfb8a:/app/vendor/emartech/emarsys-magento2-extension$ git branch
CI-pipeline
list
master
* mreishman-Magento2.3Fix
That is exactly what I experienced when I tried this solution.
Okay, that does make since because I currently only have a test instance of Magento 2.3 running at the moment and can't test against 2.2.X. I tried before to use an ellipsis to pass through arguments into the construct method but setup:di:compile passed when I ran the test with and without my second array being being commented out.
Added required parameter to the parent construct method in
Model/ResourceModel/Api/Category.php
forMagento\Catalog\Model\ResourceModel\Category
construct parameter changes in 2.3Added version check for 2.3.0 or greater, code defaults to the old parent construct if using version 2.2 or earlier.