Skip to content

Override a function inside a model

I want to override a function inside the model, but it doesn’t work.
I just want to make correction on existing function, not adding a new function.

I did some google, some suggestion ask to use plugin method.

But I am not writing a new function. I want to make correction of existing function. What should I do?
When I was using override function method. the error message is below.

Type Error occurred when creating object: AheadAdvancedReviewsBlockEmailReviewRequestForm, Argument 5 passed to AheadAdvancedReviewsBlockEmailReviewRequestForm::__construct() must be an instance of AheadAdvancedReviewsModelProductResolver, instance of (vendor)(module)ModelProductResolver given, called in /var/www/html/Magento2/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121