Error:
Errors during compilation: Tdsoft\Pdfbuilder\Model\ResourceModel\Invoice\Grid\Collection Incompatible argument type: Required type: \Magento\Framework\DB\Adapter\AdapterInterface. Actual type: \Tdsoft\Pdfbuilder\Model\ResourceModel\Invoice\Grid\connection; File: /home/sertarul/public_html/app/code/Tdsoft/Pdfbuilder/Model/ResourceModel/Invoice/Grid/Collection.php
Total Errors Count: 1
Collection.php content:
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,
$model = 'Magento\Framework\View\Element\UiComponent\DataProvider\Document',
$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->_init($model, $resourceModel);
$this->setMainTable($mainTable);
}
2 Answers 2
Please $connection use as below in the Collection.php
public function __construct(
...
\Magento\Framework\DB\Adapter\AdapterInterface $connection = null,
...
) {
...
}
Again do the compile
Reference link:-https://magento.stackexchange.com/q/193709
-
Hello, i tried that but now the compile is not running. Neither the upgrade or any other commands.cashtrader– cashtrader2017年12月02日 08:19:22 +00:00Commented Dec 2, 2017 at 8:19
-
what exact magento version you are using ? 2.21 (or) 2.1.x ?Nagaraju Kasa– Nagaraju Kasa2017年12月02日 08:20:43 +00:00Commented Dec 2, 2017 at 8:20
-
you are welcomeNagaraju Kasa– Nagaraju Kasa2017年12月02日 08:42:02 +00:00Commented Dec 2, 2017 at 8:42
I have changed the line
$connection = null,
with
\Magento\Framework\DB\Adapter\AdapterInterface $connection = null,
Now is working!
-
1yes that what i told goodNagaraju Kasa– Nagaraju Kasa2017年12月02日 08:23:25 +00:00Commented Dec 2, 2017 at 8:23
-
1This is exactly what @NagarajuKasa recommended. Why didn't you just accept his answer?seanbreeden– seanbreeden2018年09月04日 14:26:15 +00:00Commented Sep 4, 2018 at 14:26