I want to override Magento Reports module and it's not working. here's my code :
di.xml
<preference for="Magento\Reports\Model\ResourceModel\Report\Collection" type="SZK\Shamsi\Model\ResourceModel\Report\Collection" />
SZK\Shamsi\Model\ResourceModel\Report\Collection
namespace SZK\Shamsi\Model\ResourceModel\Report;
use Magento\Reports\Model\ResourceModel\Report\Collection as OrgCollection;
use Morilog\Jalali\jDate;
class Collection extends OrgCollection
{
/**
* @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
* @param \Magento\Reports\Model\ResourceModel\Report\Collection\Factory $collectionFactory
*/
public function __construct(
\Magento\Framework\Data\Collection\EntityFactory $entityFactory,
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
\Magento\Reports\Model\ResourceModel\Report\Collection\Factory $collectionFactory
)
{
parent::__construct($entityFactory, $localeDate, $collectionFactory);
}
/**
* @param \DateTime $dateStart
* @return array
* @throws \Magento\Framework\Exception\LocalizedException
*/
protected function _getDayInterval(\DateTime $dateStart)
{
$interval = [
'period' => jDate::forge($dateStart)->format('Y-m-d'),
'start' => $this->_localeDate->convertConfigTimeToUtc($dateStart->format('Y-m-d 00:00:00')),
'end' => $this->_localeDate->convertConfigTimeToUtc($dateStart->format('Y-m-d 23:59:59')),
];
return $interval;
}
}
everything seems ok but it's not working.