public function __construct(
\Magento\Framework\Data\Collection\EntityFactoryInterface $entity,
\Psr\Log\LoggerInterface $logger,
\Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
\Magento\Framework\Event\ManagerInterface $event,
\Magento\Store\Model\StoreManagerInterface $store,
\Magento\Customer\Model\Session $customerSession,
$mainTable,
$eventPrefix,
$eventObject,
$resourceModel,
$model = \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class,
$connection = null,
\Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null
) {
parent::__construct($entity, $logger, $fetchStrategy, $event, $store, $connection, $resource);
$this->_eventPrefix = $eventPrefix;
$this->_eventObject = $eventObject;
$this->_init($model, $resourceModel);
$this->setMainTable($mainTable);
$this->_customerSession = $customerSession;
}
I want to change the parameter of the constructor. This module is installed by the composer and while compiling the code I am getting the issue
Incompatible argument type: Required type: \Magento\Framework\DB\Adapter\AdapterInterface. Actual type: \Magento\Framework\Model\ResourceModel\Db\AbstractDb; File:
So I am adding another module in the app/code/ directory and passing these argument to solve the issue
public function __construct(
\Magento\Framework\Data\Collection\EntityFactoryInterface $entity,
\Psr\Log\LoggerInterface $logger,
\Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
\Magento\Framework\Event\ManagerInterface $event,
\Magento\Store\Model\StoreManagerInterface $store,
\Magento\Customer\Model\Session $customerSession,
$mainTable,
$eventPrefix,
$eventObject,
$resourceModel,
$model = \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class,
\Magento\Framework\DB\Adapter\AdapterInterface $connection = null,
\Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null
) {
parent::__construct($entity, $logger, $fetchStrategy, $event, $store, $connection, $resource);
$this->_eventPrefix = $eventPrefix;
$this->_eventObject = $eventObject;
$this->_init($model, $resourceModel);
$this->setMainTable($mainTable);
$this->_customerSession = $customerSession;
}
I am using preference to override the same file. Actually When I am passing the dependency in the core module then it is working fine but I don't want to make any changes in this module. then How can I replace these arguments using a custom module.