0

I have created a preference to override a class but constantly getting error "Class not found" before deleting "generated" folder content:

Error:

Fatal error: Uncaught Error: Class 'Vendor\Module\Plugin\Firebear\Loader' not found in /var/www/html/Dr/Project/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:111 Stack trace: #0 /var/www/html/Dr/Project/vendor/magento/framework/ObjectManager/Factory/Compiled.php(108): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject

Created Preference:

<preference for="Magento\ConfigurableProduct\Model\Product\ReadHandler" type="Vendor\Module\Plugin\FireBear\ReadHandler" />

Preference Class:

namespace Vendor\Module\Plugin\FireBear;

use Magento\Catalog\Api\Data\ProductInterface;
use Vendor\Module\Plugin\FireBear\Loader;
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
use Magento\Framework\EntityManager\Operation\ExtensionInterface;
{
class ReadHandler implements ExtensionInterface
/**
 * @var Loader
 */
private $optionLoader;

/**
 * ReadHandler constructor
 *
 * @param Loader $optionLoader
 */
public function __construct(Loader $optionLoader)
{
    $this->optionLoader = $optionLoader;
}

After running :

bin/magento s:up 
bin/magento s:d:c 
bin/magento c:f

This error is coming but after deleting generated/* this error seems resolved.

Then again this error comes after every bin/magento s:up && bin/magento s:d:c && bin/magento c:f

  • Vendor\Module\Plugin\FireBear\Loader file exist or not ? – Rk Rathod Mar 18 at 10:27
  • Yes it exists in my custom module. Right after I delete generated folder content this error is not coming – Narendra Vyas Mar 18 at 10:28
  • Seems as if I have a typo Firebear insteed of FireBear. :( Let me check – Narendra Vyas Mar 18 at 10:30
  • Yes it was a typo thanks a lot @RonakRathod anyways – Narendra Vyas Mar 18 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.