I am trying to override this class
MagentoReportsModelResourceModelReportCollectionAbstractCollection
This is a simple class not abstract class
Here is some code example of core class
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace MagentoReportsModelResourceModelReportCollection;
/**
* Report collection abstract model
*
* @api
* @since 100.0.2
*/
class AbstractCollection extends MagentoFrameworkModelResourceModelDbCollectionAbstractCollection
{
/**
* From date
*
* @var string
*/
protected $_from = null;
/**
* To date
*
* @var string
*/
protected $_to = null;
But when i am trying to override this class in my custom module than it is not overriding.
Here is the code which i am writing for override
app/code/MyVendor/MyModule/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="MagentoReportsModelResourceModelReportCollectionAbstractCollection" type="MyVendorMyModuleRewriteMagentoReportsModelResourceModelReportCollectionAbstractCollection"/>
</config>
app/code/MyVendor/MyModule/Rewrite/Magento/Reports/Model/ResourceModel/Report/Collection/AbstractCollection.php
<?php
/**
* Copyright © All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace MyVendorMyModuleRewriteMagentoReportsModelResourceModelReportCollection;
class AbstractCollection extends MagentoReportsModelResourceModelReportCollectionAbstractCollection
{
protected function _applyStoresFilterToSelect(MagentoFrameworkDBSelect $select)
{
echo "i want to override this method"; die;
}
}
After writing this code. Methods of that class are still showing content from the core class.
Any help will be appreciated.