src/EventSubscriber/EasyAdminSubscriber.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\EventSubscriber;
  3. use EasyCorp\Bundle\EasyAdminBundle\Event\AfterEntityBuiltEvent;
  4. use EasyCorp\Bundle\EasyAdminBundle\Event\AfterEntityPersistedEvent;
  5. use EasyCorp\Bundle\EasyAdminBundle\Event\AfterEntityUpdatedEvent;
  6. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  7. class EasyAdminSubscriber implements EventSubscriberInterface
  8. {
  9. public static function getSubscribedEvents()
  10. {
  11. return [
  12.     AfterEntityPersistedEvent::class => ['crea'],
  13.     AfterEntityUpdatedEvent::class => ['actualiza'],
  14. ];
  15. }
  16. public function actualiza(AfterEntityUpdatedEvent $event)
  17. {
  18.     exec("mosquitto_pub -h localhost -t acceso -m 'update'");
  19. }
  20. public function crea(AfterEntityPersistedEvent $event)
  21. {
  22.     exec("mosquitto_pub -h localhost -t acceso -m 'update'");
  23. }
  24. }