cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.4.2 (fix) Issue main.CRITICAL: Error: Interceptor::addCustomerFilter()

Magento 2.4.2 (fix) Issue main.CRITICAL: Error: Interceptor::addCustomerFilter()

We encounter the following error in magento 2.4.2 when we trying to edit a client.

 

Error :

 

[2021-09-09 16:50:42] main.CRITICAL: Error: Call to undefined method Emipro\CustomNewsletterSender\Model\ResourceModel\Queue\Collection\Interceptor::addCustomerFilter() in vendor/magento/module-customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid.php:104

 

Grid.php:104 (original code / error addCustomerFilter ) :

   /**
     * @inheritdoc
     */
    protected function _prepareCollection()
    {
        $customerId = $this->getCurrentCustomerId();
        $collection = $this->_collectionFactory->create()->addTemplateInfo()->addCustomerFilter($customerId);
        $this->setCollection($collection);

        return parent::_prepareCollection();
    }

Fix :

 

/**
* @inheritdoc
*/
protected function _prepareCollection()
{
$customerId = $this->getCurrentCustomerId();
$collection = $this->_collectionFactory->create()->addTemplateInfo()->addSubscriberFilter(
$customerId
);

$this->setCollection($collection);

return parent::_prepareCollection();
}

I think this is something that can be further explored in the  next core versions

 

Best , Pascal