Error during compilation of Magento 2 Incompatible argument type : Required type:
-
15-04-2021 - |
سؤال
Webkul\VendorPos\Model\ResourceModel\Orders\Grid\Collection
Incompatible argument type:
Required type: \Magento\Framework\App\Config\ScopeConfigInterface.
Actual type: \Magento\Framework\DB\Adapter\AdapterInterface;
public function __construct(
\Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory,
\Psr\Log\LoggerInterface $logger,
\Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
\Magento\Framework\Event\ManagerInterface $eventManager,
$mainTable,
$eventPrefix,
$eventObject,
$resourceModel,
\Webkul\Marketplace\helper\Data $mpHelper,
$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(
$entityFactory,
$logger,
$fetchStrategy,
$eventManager,
$connection,
$resource
);
$this->_eventPrefix = $eventPrefix;
$this->_eventObject = $eventObject;
$this->mpHelper = $mpHelper;
$this->_init($model, $resourceModel);
$this->setMainTable($mainTable);
}
File: /var/www/html/app/code/Webkul/VendorPos/Model/ResourceModel/Orders/Grid/Collection.php
\Magento\Framework\DB\Adapter\AdapterInterface
المحلول
Based on your question, the constructor you are using missing ScopeConfigInterface
, because it's using by your parent construct.
Your code:
parent::__construct(
$entityFactory,
$logger,
$fetchStrategy,
$eventManager,
$connection,
$resource
);
It should be
parent::__construct(
$entityFactory,
$logger,
$fetchStrategy,
$eventManager,
$scopeConfig,
$connection,
$resource
);
You will need to add the scope config into your constructor and make it matches what you see in parent::__construct()
.
لا تنتمي إلى magento.stackexchange