I have two modules, as "AuthorizenetCim" and "AuthorizeRobin".
In "AuthorizenetCim" model file, I want to get collection of "AuthorizeRobin" module.
So my constructor for "AuthorizenetCim" (/model/Gateway.php
) is:
public function __construct(
\ParadoxLabs\TokenBase\Helper\Data $helper,
\ParadoxLabs\TokenBase\Model\Gateway\Xml $xml,
\ParadoxLabs\TokenBase\Model\Gateway\ResponseFactory $responseFactory,
\Magento\Framework\HTTP\ZendClientFactory $httpClientFactory,
\Magento\Framework\Module\Dir $moduleDir,
\Magento\Framework\Registry $registry,
/*Injecting other module's model factory */
\Neo\Authorizerobin\Model\AuthorizerobinFactory $authorizeRobinFactory,
/*Injection done*/
array $data = []
) {
$this->moduleDir = $moduleDir;
$this->registry = $registry;
$this->authorizeRobinFactory = $authorizeRobinFactory;
parent::__construct(
$helper,
$xml,
$responseFactory,
$httpClientFactory,
$data
);
}
But I am getting following error for my constructor:
<b>Fatal error</b>: Uncaught TypeError: Argument 7 passed to ParadoxLabs\Authnetcim\Model\Gateway::__construct
() must be an instance of Neo\Authorizerobin\Model\AuthorizerobinFactory, array given, called in /var
/www/html/magento2/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 93 and
defined in /var/www/html/magento2/app/code/ParadoxLabs/Authnetcim/Model/Gateway.php:182
Stack trace:
#0 /var/www/html/magento2/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(93): ParadoxLabs
\Authnetcim\Model\Gateway->__construct(Object(ParadoxLabs\TokenBase\Helper\Data), Object(ParadoxLabs
\TokenBase\Model\Gateway\Xml), Object(ParadoxLabs\TokenBase\Model\Gateway\ResponseFactory), Object(Magento
\Framework\HTTP\ZendClientFactory), Object(Magento\Framework\Module\Dir), Object(Magento\Framework\Registry
), Array)
#1 /var/www/html/magento2/vendor/magento/framework/ObjectManager/Factory/Compiled.php(88): Magento\Framework
\ObjectManager\Factory\AbstractFactory->createObject('ParadoxLabs\\Aut...', Array)
#2 /var/ in <b>/var/www/html/magento2/app/code/ParadoxLabs/Authnetcim/Model/Gateway.php</b> on line
<b>182</b><br />
{"messages":{"error":[{"code":500,"message":"Server internal error. See details in report api\/308753050106"
}]}}
rm -rf var/generation/*
from the magento root directory