cancel
Showing results for 
Search instead for 
Did you mean: 

Changing settings for the BlockInterface class in the construct function

Changing settings for the BlockInterface class in the construct function

Hello

 

Since the magento update in 2.3.5 , the following code no longer works:

 

use Magento\Widget\Block\BlockInterface;

class Slick extends \Magento\CatalogWidget\Block\Product\ProductsList implements BlockInterface
{

    const DEFAULT_LIST_TYPE = 'news';

    /**
     * @var \Magento\Sales\Model\ResourceModel\Report\Bestsellers\CollectionFactory
     */
    protected $_bestsellersCollectionFactory;

    public function __construct(
        // ORIGINAL ARGUMENTS
        \Magento\Catalog\Block\Product\Context $context,
        \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
        \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility,
        \Magento\Framework\App\Http\Context $httpContext,
        \Magento\Rule\Model\Condition\Sql\Builder $sqlBuilder,
        \Magento\CatalogWidget\Model\Rule $rule,
        \Magento\Widget\Helper\Conditions $conditionsHelper,
        \Magento\Sales\Model\ResourceModel\Report\Bestsellers\CollectionFactory $bestsellersCollectionFactory,
        array $data = []

The $data seems to be the problem during compile

 

Errors during compilation:
        MonModule\SlickWidget\Block\Slick
                Incompatible argument type: Required type: \Magento\Catalog\Api\CategoryRepositoryInterface. Actual type: array; File:
 
/var/www/magento/app/code/MonModule/SlickWidget/Block/Slick.php

Did anyone had this problem?

 

Regards