May be i'm missing something really small.
Here is a class Class1
namespace Vendor\Module\Helper;
class Class1 extends AbstractHelper
{
/** @var Client */
private $client;
/** @var ConfigHelper */
private $config;
public function __construct(
Context $context,
){
parent::__construct($context);
$this->config = $configHelper;
//stuff are here
}
Here is Class2 which i want to override
namespace Vendor\Module\Helper;
use Vendor\Module\Helper\Class1;
class Data
{
private $class1Helper;
private $pageHelper;
private $productHelper;
private $storeManager;
public function __construct(
Class1 $class1Helper,
ConfigHelper $configHelper,
PageHelper $pageHelper,
StoreManagerInterface $storeManager
) {
$this->class1Helper = $class1Helper ;
$this->configHelper = $configHelper;
$this->pageHelper = $pageHelper;
$this->storeManager = $storeManager;
}
Now Here is my class. Added preference in di.xml
<preference for="Vendor\Module\Helper\Data" type="Vendornew\Module\Helper\Data"/>
namespace Vendornew\Module\Helper;
class Data extends \Vendor\Module\Helper\Data;
{
public function __construct(
Class1 $class1Helper,
ConfigHelper $configHelper,
PageHelper $pageHelper,
StoreManagerInterface $storeManager
) {
$this->class1Helper = $class1Helper ;
parent::__construct(
$class1Helper,
$configHelper,
$pageHelper,
$storeManager
);
}
public function getSomething()
{
return 'something';
}
}
Any idea why it gives Vendor\Module\Helper\Data doesn't extends Magento\Framework\App\Helper\AbstractHelper