magento / meta-for-magento2

38 stars 22 forks source link

Deployment fails during setup:di:compile step with the error "Invalid Factory for nonexistent class" #77

Closed yurii-denyshchenko closed 2 months ago

yurii-denyshchenko commented 3 months ago

There are used incorrect class names in the plugin vendor/meta/module-catalog/Plugin/FacebookCatalogUpdateFullReindexPlugin.php:

Steps to reproduce (*)

Proposed Solution:

--- a/vendor/meta/module-catalog/Plugin/FacebookCatalogUpdateFullReindexPlugin.php
+++ b/vendor/meta/module-catalog/Plugin/FacebookCatalogUpdateFullReindexPlugin.php
@@ -22,8 +22,8 @@

 use Meta\Catalog\Model\ResourceModel\FacebookCatalogUpdate as FBCatalogUpdateResourceModel;
 use Magento\Indexer\Model\Indexer;
-use Magento\Framework\Mview\View\ChangelogBatchWalker;
-use Magento\Framework\Mview\View\ChangelogBatchWalkerFactory;
+use Magento\Framework\Mview\View\ChangeLogBatchWalker;
+use Magento\Framework\Mview\View\ChangeLogBatchWalkerFactory;
 use Magento\Framework\Mview\View;
 use Magento\Indexer\Model\WorkingStateProvider;

@@ -40,7 +40,7 @@
     private $fbCatalogUpdateResourceModel;

     /**
-     * @var ChangelogBatchWalkerFactory
+     * @var ChangeLogBatchWalkerFactory
      */
     private $changelogBatchWalkerFactory;

@@ -54,12 +54,12 @@
      *
      * @param WorkingStateProvider $workingStateProvider
      * @param FBCatalogUpdateResourceModel $fbCatalogUpdateResourceModel
-     * @param ChangelogBatchWalkerFactory $changelogBatchWalkerFactory
+     * @param ChangeLogBatchWalkerFactory $changelogBatchWalkerFactory
      */
     public function __construct(
         WorkingStateProvider         $workingStateProvider,
         FBCatalogUpdateResourceModel $fbCatalogUpdateResourceModel,
-        ChangelogBatchWalkerFactory  $changelogBatchWalkerFactory
+        ChangeLogBatchWalkerFactory  $changelogBatchWalkerFactory
     ) {
         $this->workingStateProvider = $workingStateProvider;
         $this->fbCatalogUpdateResourceModel = $fbCatalogUpdateResourceModel;
@@ -85,7 +85,7 @@
         $nextVersionId = $cl->getVersion();

         while ($currentVersionId < $nextVersionId) {
-            $walker = $this->changelogBatchWalkerFactory->create(ChangelogBatchWalker::class);
+            $walker = $this->changelogBatchWalkerFactory->create(ChangeLogBatchWalker::class);
             $batches = $walker->walk($cl, $currentVersionId, $nextVersionId, $batchSize);

             foreach ($batches as $ids) {

Expected result (*)

No errors during deployment

Actual result (*)

Deployment fails during setup:di:compile step with the error "Invalid Factory for nonexistent class" image-20240719-104143

sol-loup commented 3 months ago

Hey Yurii,

Unfortunately, this is a side-effect of a change to Magento core itself, which published a one-character change to this class late last year. While this change is in the most recent magento versions (2.4-develop and up), some older versions may still be using the legacy casing

https://github.com/magento/magento2/commit/83eaa599ca07d95d4f448e60de83e435a34b69e8

You can resolve this by overriding this file in app/code with the legacy casing. At the moment, we are exploring the resourcing required to support more legacy builds of Magento

zlik commented 3 months ago

Hi @yurii-denyshchenko, so far, we haven't been able to reproduce. Knowing your Magento and PHP versions, and also the type version of the OS and/or server description would help us tremendously in troubleshooting this. Appreciate any details!

Bashev commented 3 months ago

@yurii-denyshchenko looks like you are using magento < 2.4.7 and trying to install meta-for-magento2 = 1.3.2

From version 2.4.7 magento changes ChangelogWatcher https://github.com/magento/magento2/commit/57889b5696048bf8447355bd9e29f5cdf38e0aa1

then also is changed in this module from version 1.3.2 https://github.com/magento/meta-for-magento2/commit/eb9009ba9f20e7bfd147ff0313c3641fb696cfd3

@zlik can you add proper dependencies meta catalog module 1.3.2 must require magento/framework: >=103.0.7 https://github.com/magento/meta-for-magento2/blob/601a4864ebcb65acb3e32290680903fe477b7249/app/code/Meta/Catalog/composer.json#L7

zlik commented 2 months ago

@Bashev, we are actually going to support both ChangeLogBatchWalker and ChangelogBatchWalker to make the extension compatible with a wide range of Magento versions (2.4.3+). Fix is coming up soon, please stay tuned for updates.

zlik commented 2 months ago

This has been fixed in v1.3.3. @Bashev please let us know if this is still an issue. Closing the issue.