<?php
namespace App\Grid;
use Sylius\Component\Grid\Event\GridDefinitionConverterEvent;
class AdminCustomerGridListener
{
public function addLimitFilter(GridDefinitionConverterEvent $event): void
{
$grid = $event->getGrid();
$dateFilter = $grid->getFilter('createdAt');
if ($dateFilter) {
if (!$dateFilter->getCriteria()) {
$dateFilter->setCriteria(['from' => ['date' => date('Y-m-d', strtotime('- 1 week')), 'time' => '']]);
}
}
}
}