This commit is contained in:
Simon Vieille 2022-04-26 15:02:26 +02:00
parent 577531e394
commit abd6d0056a
Signed by: deblan
GPG key ID: 579388D585F70417

View file

@ -64,7 +64,7 @@ Events are dispatched before and after creation, update and deletion. All entiti
```
// src/EventSuscriber/MyEntityEventSubscriber.php
namespace App\EventSuscriber;
namespace App\EventSubscriber;
use App\Core\Entity\EntityInterface;
use App\Core\Event\EntityManager\EntityManagerEvent;
@ -73,14 +73,14 @@ use App\Entity\MyEntity;
class MyEntityEventSubscriber extends EntityManagerEventSubscriber
{
public function support(EntityInterface $entity)
public function supports(EntityInterface $entity): bool
{
return $entity instanceof MyEntity;
}
public function onCreate(EntityManagerEvent $event)
{
if (!$this->support($event->getEntity())) {
if (!$this->supports($event->getEntity())) {
return;
}
@ -89,7 +89,7 @@ class MyEntityEventSubscriber extends EntityManagerEventSubscriber
public function onUpdate(EntityManagerEvent $event)
{
if (!$this->support($event->getEntity())) {
if (!$this->supports($event->getEntity())) {
return;
}
@ -98,7 +98,7 @@ class MyEntityEventSubscriber extends EntityManagerEventSubscriber
public function onDelete(EntityManagerEvent $event)
{
if (!$this->support($event->getEntity())) {
if (!$this->supports($event->getEntity())) {
return;
}
@ -107,7 +107,7 @@ class MyEntityEventSubscriber extends EntityManagerEventSubscriber
public function onPreCreate(EntityManagerEvent $event)
{
if (!$this->support($event->getEntity())) {
if (!$this->supports($event->getEntity())) {
return;
}
@ -116,7 +116,7 @@ class MyEntityEventSubscriber extends EntityManagerEventSubscriber
public function onPreUpdate(EntityManagerEvent $event)
{
if (!$this->support($event->getEntity())) {
if (!$this->supports($event->getEntity())) {
return;
}
@ -125,7 +125,7 @@ class MyEntityEventSubscriber extends EntityManagerEventSubscriber
public function onPreDelete(EntityManagerEvent $event)
{
if (!$this->support($event->getEntity())) {
if (!$this->supports($event->getEntity())) {
return;
}