murph-skeleton/core/EventSubscriber/EntityManagerEventSubscriber.php

53 lines
1.4 KiB
PHP
Raw Normal View History

2021-03-24 12:27:07 +01:00
<?php
namespace App\Core\EventSubscriber;
2021-03-24 12:27:07 +01:00
use App\Core\Event\EntityManager\EntityManagerEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* class EntityManagerEventSubscriber.
*
* @author Simon Vieille <simon@deblan.fr>
*/
abstract class EntityManagerEventSubscriber implements EventSubscriberInterface
{
2021-05-12 11:56:48 +02:00
protected static int $priority = 0;
2021-03-24 12:27:07 +01:00
public static function getSubscribedEvents()
{
return [
EntityManagerEvent::CREATE_EVENT => ['onCreate', self::$priority],
EntityManagerEvent::UPDATE_EVENT => ['onUpdate', self::$priority],
EntityManagerEvent::DELETE_EVENT => ['onDelete', self::$priority],
EntityManagerEvent::PRE_CREATE_EVENT => ['onPreCreate', self::$priority],
EntityManagerEvent::PRE_UPDATE_EVENT => ['onPreUpdate', self::$priority],
EntityManagerEvent::PRE_DELETE_EVENT => ['onPreDelete', self::$priority],
2021-03-24 12:27:07 +01:00
];
}
public function onCreate(EntityManagerEvent $event)
{
}
public function onUpdate(EntityManagerEvent $event)
{
}
public function onDelete(EntityManagerEvent $event)
{
}
public function onPreCreate(EntityManagerEvent $event)
{
}
public function onPreUpdate(EntityManagerEvent $event)
{
}
public function onPreDelete(EntityManagerEvent $event)
{
}
}