Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class "Magento\Framework\Mview\View\ChangeLogBatchWalker" does not exist #88

Open
Quazz opened this issue Sep 25, 2024 · 1 comment
Open

Comments

@Quazz
Copy link

Quazz commented Sep 25, 2024

Preconditions (*)

  1. Magento 2.4.7-p1
  2. Meta 1.3.3

Steps to reproduce (*)

  1. Install and configure the extension
  2. Wait for indexing

Expected result (*)

  1. Reindexes, no errors

Actual result (*)

  1. Reindex fails because it can't find the class

There was an attempt to support both the older and current versions of Magento.

Unfortunately the implementation does not work currently.

if (class_exists(\Magento\Framework\Mview\View\ChangeLogBatchWalkerFactory::class)) { // @phpstan-ignore-line

The issue is on this line.

The problem is that class_exists PHP function searches for the class in a case insensitive manner and will thus always return ChangeLogBatchWalker and never ChangelogBatchWalker. (in fact PHP treats classes in case insensitive manner in general, but the autoloader does not)

My suggestion would be something like this:

        $changeLogWalkerFactory = $this->objectManager->create(
            \Magento\Framework\Mview\View\ChangeLogBatchWalkerFactory::class // @phpstan-ignore-line
        );
        if (get_class($changeLogWalkerFactory) == "ChangeLogBatchWalkerFactory") {
            return $changeLogWalkerFactory->create(
                \Magento\Framework\Mview\View\ChangeLogBatchWalker::class // @phpstan-ignore-line
            );
        }

        $changelogWalkerFactory = $this->objectManager->create(
            \Magento\Framework\Mview\View\ChangelogBatchWalkerFactory::class // @phpstan-ignore-line
        );
        return $changelogWalkerFactory->create(
            \Magento\Framework\Mview\View\ChangelogBatchWalker::class // @phpstan-ignore-line
        );

get_class will return the actual class name in use, case sensitive.

@sol-loup
Copy link
Contributor

sol-loup commented Nov 8, 2024

Confirmed:

Design Config Grid index has been rebuilt successfully in 00:00:00
Customer Grid index has been rebuilt successfully in 00:00:00
Category Products index has been rebuilt successfully in 00:00:03
Product Categories index has been rebuilt successfully in 00:00:00
Catalog Rule Product index has been rebuilt successfully in 00:00:00
Product EAV index has been rebuilt successfully in 00:00:00
Stock index has been rebuilt successfully in 00:00:00
Inventory index has been rebuilt successfully in 00:00:00
Catalog Product Rule index has been rebuilt successfully in 00:00:00
Product Price index has been rebuilt successfully in 00:00:00
Catalog Search index has been rebuilt successfully in 00:00:10
Stores Feed index has been rebuilt successfully in 00:00:00
Sales Order Feed index has been rebuilt successfully in 00:00:00
Sales Order Statuses Feed index has been rebuilt successfully in 00:00:00

Added into our next build. Thanks @Quazz !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants