1

I am using under given module. https://magecomp.com/magento-2-image-clean.html

Till Magento 2.3.1 it's working perfectly. After upgrade to 2.3.2 it giving under given error:

Type Error occurred when creating object: Magecomp\Imageclean\Model\ResourceModel\Imageclean\Grid\Collection\Interceptor

Please Guide me to solve this.

File:Magecomp\Imageclean\Model\ResourceModel\Imageclean\Grid\Collection.php

<?php
namespace Magecomp\Imageclean\Model\ResourceModel\Imageclean\Grid;

use Magento\Framework\Api\Search\SearchResultInterface;
use Magento\Framework\Search\AggregationInterface;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\ScopeInterface;

class Collection extends \Magecomp\Imageclean\Model\ResourceModel\Imageclean\Collection implements SearchResultInterface
{
    protected $aggregations;
    /**
     * @var ScopeConfigInterface
     */
    protected $scopeConfig;
    protected $curstoreid;

    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,
        \Magento\Store\Model\StoreManagerInterface $storeManager,
        ScopeConfigInterface $configScopeConfigInterface,
        \Magento\Framework\App\Request\Http $request,
        $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);
    }

    public function getAggregations()
    {
        return $this->aggregations;
    }

    public function setAggregations($aggregations)
    {
        $this->aggregations = $aggregations;
    }

    public function getAllIds($limit = null, $offset = null)
    {
        return $this->getConnection()->fetchCol($this->_getAllIdsSelect($limit, $offset), $this->_bindParams);
    }

    public function getSearchCriteria()
    {
        return null;
    }

    public function setSearchCriteria(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria = null)
    {
        return $this;
    }

    public function getTotalCount()
    {
        return $this->getSize();
    }

    public function setTotalCount($totalCount)
    {
        return $this;
    }

    public function setItems(array $items = null)
    {
        return $this;
    }
}
  • Please share answer if you figured the problem, looking for same – Ajwad Syed Sep 11 at 8:50
0

Remove Cache it will solve the problem

rm -rf var/generation/ var/view_preprocessed/ pub/static/frontend/ pub/static/_requirejs/ var/cache var/di var/page_cache pub/static/_cache

Hope it helps.

  • Execute so many times. Tried all CLI no luck. – JACK Jul 25 at 11:41
-1

Add These Comments Before Constructor in Collection.php

   /**
     * Collection constructor
     *
     * @param Context $context
     * @param string|null $connection
     */
  • Not working. tried all CLI command. need some code fix. – JACK Jul 25 at 11:43
  • @JACK this Error Occurs usually when you have inject a class and havn't generated interceptors check my updated answer – Waqar Ali Jul 25 at 11:50
  • @Wawar It's not working for me. Tried but the error still there. – JACK Jul 25 at 11:53
  • check my updated answer – Waqar Ali Jul 25 at 11:58
  • Comment added. Still same error. – JACK Jul 25 at 12:05

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.