Skip to main content
deleted 413 characters in body
Source Link
7ochem
  • 7.6k
  • 16
  • 54
  • 82

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 removesolve 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 abovementioned error.

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.

To solve 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 mentioned error.

Source Link
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.