Hi I am facing issue deprecating issue of below explode function,
public function getStreet()
{
if (is_array($this->getData(OrderAddressInterface::STREET))) {
return $this->getData(OrderAddressInterface::STREET);
}
return explode(PHP_EOL, $this->getData(OrderAddressInterface::STREET));
}
And for this i want to override this file and following below steps, 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\Sales\Model\Order" type="Vendor\Coreextended\Model\Order" />
</config>
file path Vendor/Coreextended/Model/Order/Address.php
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Vendor\Coreextended\Model\Order;
use Magento\Customer\Model\Address\AddressModelInterface;
use Magento\Sales\Api\Data\OrderAddressInterface;
use Magento\Sales\Model\AbstractModel;
class Address extends \Magento\Sales\Model\Order implements OrderAddressInterface, AddressModelInterface
{
/**
* Retrieve street field of an address
*
* @return string[]
*/
public function getStreet()
{
if (is_array($this->getData(OrderAddressInterface::STREET))) {
return $this->getData(OrderAddressInterface::STREET);
}
return explode(PHP_EOL, $this->getData(OrderAddressInterface::STREET) ?? '');
}
}
but getting error
[message] => Class "Vendor\Coreextended\Model\Order" does not exist [code] => -1 [trace] => #0 /home/theboozybutton/public_html/vendor/magento/framework/Code/Reader/ClassReader.php(34): ReflectionClass->__construct() #1 /home/theboozybutton/public_html/vendor/magento/framework/ObjectManager/Definition/Runtime.php(54): Magento\Framework\Code\Reader\ClassReader->getConstructor() #2 /home/theboozybutton/public_html/vendor/magento/framework/ObjectManager/Factory/Compiled.php(100): Magento\Framework\ObjectManager\Definition\Runtime->getParameters() #3 /home/theboozybutton/public_html/vendor/magento/framework/Object