Skip to main content
Bumped by Community user
Bumped by Community user
added 23 characters in body
Source Link
Qaisar Satti
  • 32.5k
  • 18
  • 87
  • 137

I writed a preference for class Magento\Catalog\Helper\Image but i got this error:

Recoverable Error: Argument 4 passed to Magento\Checkout\Block\Cart\Sidebar\Interceptor::__construct() must be an Instance of Magento\Catalog\Helper\Image, instance of RMI\ImageCDN\Helper\Image given, called in C:\xampp\htdocs\magento\vendor\magento\framework\ObjectManager\Factory\AbstractFactory.php on line 107 and defined in C:\xampp\htdocs\magento\var\generation\Magento\Checkout\Block\Cart\Sidebar\Interceptor.php on line 11

Recoverable Error: Argument 4 passed to Magento\Checkout\Block\Cart\Sidebar\Interceptor::__construct() must be an Instance of Magento\Catalog\Helper\Image, instance of RMI\ImageCDN\Helper\Image given, called in C:\xampp\htdocs\magento\vendor\magento\framework\ObjectManager\Factory\AbstractFactory.php on line 107 and defined in C:\xampp\htdocs\magento\var\generation\Magento\Checkout\Block\Cart\Sidebar\Interceptor.php on line 11

If preference is not a good way to override a helper in core , what is the solution?

I writed a preference for class Magento\Catalog\Helper\Image but i got this error:

Recoverable Error: Argument 4 passed to Magento\Checkout\Block\Cart\Sidebar\Interceptor::__construct() must be an Instance of Magento\Catalog\Helper\Image, instance of RMI\ImageCDN\Helper\Image given, called in C:\xampp\htdocs\magento\vendor\magento\framework\ObjectManager\Factory\AbstractFactory.php on line 107 and defined in C:\xampp\htdocs\magento\var\generation\Magento\Checkout\Block\Cart\Sidebar\Interceptor.php on line 11

If preference is not a good way to override a helper in core , what is the solution?

I writed a preference for class Magento\Catalog\Helper\Image but i got this error:

Recoverable Error: Argument 4 passed to Magento\Checkout\Block\Cart\Sidebar\Interceptor::__construct() must be an Instance of Magento\Catalog\Helper\Image, instance of RMI\ImageCDN\Helper\Image given, called in C:\xampp\htdocs\magento\vendor\magento\framework\ObjectManager\Factory\AbstractFactory.php on line 107 and defined in C:\xampp\htdocs\magento\var\generation\Magento\Checkout\Block\Cart\Sidebar\Interceptor.php on line 11

If preference is not a good way to override a helper in core , what is the solution?

Source Link
ali gh
  • 731
  • 2
  • 7
  • 22

How to override core helper in magento 2?

I writed a preference for class Magento\Catalog\Helper\Image but i got this error:

Recoverable Error: Argument 4 passed to Magento\Checkout\Block\Cart\Sidebar\Interceptor::__construct() must be an Instance of Magento\Catalog\Helper\Image, instance of RMI\ImageCDN\Helper\Image given, called in C:\xampp\htdocs\magento\vendor\magento\framework\ObjectManager\Factory\AbstractFactory.php on line 107 and defined in C:\xampp\htdocs\magento\var\generation\Magento\Checkout\Block\Cart\Sidebar\Interceptor.php on line 11

If preference is not a good way to override a helper in core , what is the solution?