skip to Main Content

enter image description here

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


  1. Try Compiling the code with this command: php bin/magento setup:di:compile. I hope it helps.

    Login or Signup to reply.
  2. Just run following command using Command Line Mode

    rm -rf var/generation/*
    
    Login or Signup to reply.
  3. Generally, Magento caches the constructors in var/generation folder, so if you clear the var/generation content then Magento will regenerate the interceptor.

    rm -rf var/generation
    
    Login or Signup to reply.
  4. I had the same issue and resolving it by following steps

    First, you need to remove generated/code/* and var/cache/*

    rm -rf generated/code/* var/cache/*
    

    Second, Clean the cache

    php bin/magento cache:clean
    

    Third, Change the file permission

    sudo chmod 777 -R generated/ var/ pub/
    

    Fourth, run Generated Compile the code

    php bin/magento setup:di:compile
    
    Login or Signup to reply.
  5. Run the following commands one by one:-

    rm -rf var/*
    
    rm -rf generated
    
    php bin/magento setup:di:compile
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search