Magento 2.3.1 Getting Incompatible argument type error

by Alex Choroshin   Last Updated September 11, 2019 08:09 AM

I'm getting the following error: Incompatible argument type: Required type: \Magento\Framework\Data\Helper\PostHelper. Actual type: array.

I have tried changing the parent constructor, but I'm still getting the same error.

posting the relevant part of my code:

class ProductList extends \Magento\Catalog\Block\Product\ListProduct
{
    protected $_logger;
    protected $_searchCriteriaBuilder;
    protected $_productRepository;
    protected $_categoryRepository;
    protected $_storeManager;
    protected $_categoryFactory;
    protected $_filterBuilder;


    public function __construct(
        \Magento\Catalog\Block\Product\Context $context,
        \Magento\Framework\Data\Helper\PostHelper $postDataHelper,
        \Magento\Catalog\Api\CategoryRepositoryInterface $categoryRepository,
        \Magento\Catalog\Api\ProductRepositoryInterface $productRepository,
        \Magento\Framework\Api\FilterBuilder $filterBuilder,
        \Magento\Store\Model\StoreManagerInterface $storeManager,
        \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder,
        \Magento\Catalog\Model\Layer\Resolver $layerResolver,
        \Magefan\Blog\Model\CategoryFactory $categoryFactory,
        \Magento\Framework\Url\Helper\Data $urlHelper,
        \Psr\Log\LoggerInterface $logger,
        array $data = []
    )
    {
        $this->_logger = $logger;
        $this->_productRepository = $productRepository;
        $this->_filterBuilder = $filterBuilder;
        $this->_storeManager = $storeManager;
        $this->_searchCriteriaBuilder = $searchCriteriaBuilder;
        $this->_categoryRepository = $categoryRepository;
        $this->_categoryFactory = $categoryFactory;
    //    parent::_construct();
    //    parent::__construct($context, $data);
        parent::__construct($context, $postDataHelper, $layerResolver, $categoryRepository, $urlHelper, $data);
    }

Can anyone please assist?



Related Questions