Skip to main content
1 of 2
Pankaj Bhope
  • 1.6k
  • 13
  • 26

Argument 4 passed to Vendor\Module1\Controller\Result\Index::__construct() must be an instance of Magento\Framework\View\Result\PageFactory, instance of Magento\Search\Model\QueryFactory given, called in C:\xampp\htdocs\magento2x_5test\app\code\Vendor\Module2\Controller\Result\Index.php on line 36 and defined in C:\xampp\htdocs\magento2x_5test\app\code\Vendor\Module1\Controller\Result\Index.php on line 22

To remove this error correct the sequence of the arguments in the parent::__construct(arg1, arg2, . . .) method. It must be same as it is in the parent's __construct().

so, to remove this error :

change

parent::__construct($context, $catalogSession, $storeManager, $queryFactory, $layerResolver); 

to

parent::__construct($context, $catalogSession, $storeManager, $resultPageFactory, $layerResolver, $queryFactory); 

this should solve the above error.

Pankaj Bhope
  • 1.6k
  • 13
  • 26