<?php
namespace App\EventSubscriber;
use EasyCorp\Bundle\EasyAdminBundle\Event\AfterEntityBuiltEvent;
use EasyCorp\Bundle\EasyAdminBundle\Event\AfterEntityPersistedEvent;
use EasyCorp\Bundle\EasyAdminBundle\Event\AfterEntityUpdatedEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class EasyAdminSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
return [
AfterEntityPersistedEvent::class => ['crea'],
AfterEntityUpdatedEvent::class => ['actualiza'],
];
}
public function actualiza(AfterEntityUpdatedEvent $event)
{
exec("mosquitto_pub -h localhost -t acceso -m 'update'");
}
public function crea(AfterEntityPersistedEvent $event)
{
exec("mosquitto_pub -h localhost -t acceso -m 'update'");
}
}