I am trying to override Magento Framework Feed.php
file,
After googling alot I found how to override framework file but that's not worked for me.
Please give me the right eay to override framework feed file.
Vendor/Namespace/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Framework\App\Feed" type="Serole\Corefiles\App\Feed" />
</config>
Vendor/Namespace/App/Feed.php
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Vendor\Namespace\App;
use Zend\Feed\Writer\FeedFactory;
/**
* Default XML feed class
*/
class Feed extends \Magento\Framework\App\Feed
{
/**
* @var array
*/
private $feeds;
/**
* Feed constructor.
* @param array $data
*/
public function __construct(array $data)
{
$this->feeds = $data;
}
/**
* {@inheritdoc}
*/
public function getFormattedContent() : string
{
echo '<pre>'; print_r($this->feeds); die();
return FeedFactory::factory($this->feeds)->export(FeedFactoryInterface::FORMAT_RSS);
}
}
Please guide me.