My code display this error , anyone can help me , many thanks
Fatal error: Uncaught TypeError: Argument 2 passed to
GogoeshopProductWarrantyControllerIndexIndex::__construct() must
be an instance of MagentoCustomerModelSession, instance of
MagentoFrameworkViewResultPageFactory given, called in
C:Apache-2.4.7-win64-VC11htdocsmagentopos2generatedcodeGogoeshopProductWarrantyControllerIndexIndexInterceptor.php
on line 14 and defined in
C:Apache-2.4.7-win64-VC11htdocsmagentopos2appcodeGogoeshopProductWarrantyControllerIndexIndex.php:9
Stack trace: #0
C:Apache-2.4.7-win64-VC11htdocsmagentopos2generatedcodeGogoeshopProductWarrantyControllerIndexIndexInterceptor.php(14):
GogoeshopProductWarrantyControllerIndexIndex->__construct(Object(MagentoFrameworkAppActionContext),
Object(MagentoFrameworkViewResultPageFactory)) #1
C:Apache-2.4.7-win64-VC11htdocsmagentopos2vendormagentoframeworkObjectManagerFactoryAbstractFactory.php(111):
GogoeshopProductWarrantyControllerIndexIndexInterceptor->__construct(Object(MagentoFrameworkApp
in
C:Apache-2.4.7-win64-VC11htdocsmagentopos2appcodeGogoeshopProductWarrantyControllerIndexIndex.php
on line 9
5
Answers
Try Compiling the code with this command:
php bin/magento setup:di:compile
. I hope it helps.Just run following command using Command Line Mode
Generally, Magento caches the constructors in
var/generation
folder, so if you clear thevar/generation
content then Magento will regenerate the interceptor.I had the same issue and resolving it by following steps
First, you need to remove generated/code/* and var/cache/*
Second, Clean the cache
Third, Change the file permission
Fourth, run Generated Compile the code
Run the following commands one by one:-