0

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);
}
asked Dec 2, 2017 at 8:09

2 Answers 2

1
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

answered Dec 2, 2017 at 8:16
3
  • Hello, i tried that but now the compile is not running. Neither the upgrade or any other commands. Commented Dec 2, 2017 at 8:19
  • what exact magento version you are using ? 2.21 (or) 2.1.x ? Commented Dec 2, 2017 at 8:20
  • you are welcome Commented Dec 2, 2017 at 8:42
0

I have changed the line

 $connection = null,

with

\Magento\Framework\DB\Adapter\AdapterInterface $connection = null,

Now is working!

answered Dec 2, 2017 at 8:22
2
  • 1
    yes that what i told good Commented Dec 2, 2017 at 8:23
  • 1
    This is exactly what @NagarajuKasa recommended. Why didn't you just accept his answer? Commented Sep 4, 2018 at 14:26

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.