namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Tourze\ScheduleEntityCleanBundle\Attribute\AsScheduleClean;
#[ORM\Entity]
#[AsScheduleClean(expression: '0 0 * * *', defaultKeepDay: 30)]
class LogEntry
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column]
private \DateTimeImmutable $createTime;
// Other properties and methods...
}
namespace App\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Tourze\ScheduleEntityCleanBundle\Event\ScheduleEntityCleanFinishEvent;
class EntityCleanSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
ScheduleEntityCleanFinishEvent::class => 'onEntityCleaned',
];
}
public function onEntityCleaned(ScheduleEntityCleanFinishEvent $event): void
{
$modelClass = $event->getModelClass();
// Do something with the model class
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.