Skip to content

Magento 2 – Call method ‘MagentoFrameworkAppResponseInterface::representJson’ that does not exist on version ‘2.4.5’

I try to upgrade our magento 2 shop from 2.4.2 to 2.4.5-p1.

I get this critical error in the Upgrade Compatibility Tool Report.

Call method ‘MagentoFrameworkAppResponseInterface::representJson’
that does not exist on version ‘2.4.5’

This is the code:

class EmailToCustomerModel extends MagentoFrameworkAppActionAction
{
    ...

    /**
     * Create json response
     *
     * @return MagentoFrameworkControllerResultInterface
     */
    public function jsonResponse($response = '')
    {
        return $this->getResponse()->representJson(
            $this->jsonHelper->jsonEncode($response)
        );
    }