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);
}
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://goo.gl/ux9GnG

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

I have changed the line

 $connection = null,

with

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

Now is working!

2
  • 1
    yes that what i told good – Nagaraju K Dec 2 '17 at 8:23
  • 1
    This is exactly what @NagarajuKasa recommended. Why didn't you just accept his answer? – seanbreeden Sep 4 '18 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.