0

During compilation its shows the following error:

[Exception]
Warning: Declaration of Amy\Bookappointment\Model\ResourceModel\Grid\Collec
tion::_construct(Magento\Framework\Data\Collection\EntityFactoryInterface $ entityFactory, Psr\Log\LoggerInterface $logger, Magento\Framework\Data\Coll ection\Db\FetchStrategyInterface $fetchStrategy, Magento\Framework\Event\Ma nagerInterface $eventManager, Magento\Store\Model\StoreManagerInterface $st
oreManagerInterface, ?Magento\Framework\DB\Adapter\AdapterInterface $connec tion = NULL, ?Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = NULL) should be compatible with Magento\Framework\Model\ResourceModel\Db
\Collection\AbstractCollection::_construct() in /var/www/html/Ajaffemigrati
on/app/code/Amy/Bookappointment/Model/ResourceModel/Grid/Collection.php on line 55

Here is my code

/var/www/html/magento2/app/code/Amy/Bookappointment/Model/ResourceModel/Grid/Collection.php

<?php


namespace Amy\Bookappointment\Model\ResourceModel\Grid;

/* use required classes */
use Magento\Framework\Data\Collection\EntityFactoryInterface;
use Psr\Log\LoggerInterface;
use Magento\Framework\Data\Collection\Db\FetchStrategyInterface;
use Magento\Framework\Event\ManagerInterface;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Framework\DB\Adapter\AdapterInterface;
use Magento\Framework\Model\ResourceModel\Db\AbstractDb;


class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
{
    /**
     * @var string
     */
    protected $_idFieldName = 'customlead_id';
    /**
     * Define resource model.
     */
    protected function _construct(
        \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory,
        \Psr\Log\LoggerInterface $logger,
        \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
        \Magento\Framework\Event\ManagerInterface $eventManager,
        \Magento\Store\Model\StoreManagerInterface $storeManagerInterface,
        \Magento\Framework\DB\Adapter\AdapterInterface $connection = null,
        \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null
        )
    {
        $this->_init(
            'Amy\Bookappointment\Model\Grid',
            'Amy\Bookappointment\Model\ResourceModel\Grid'
        );

        parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource);
        $this->storeManager = $storeManager;
    }

protected function _initSelect()
    {
        parent::_initSelect();

        $this->getSelect()->joinLeft(
                ['secondTable' => $this->getTable('book_an_appointment')],
                'main_table.customlead_id = secondTable.appointment_id',
                ['','']
            );
    }

}

Any help would be appreciated.

Your Answer

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

Browse other questions tagged or ask your own question.