src/Event/News/Entry/DeleteSubscriber.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Event\News\Entry;
  3. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  4. class DeleteSubscriber implements EventSubscriberInterface
  5. {
  6.     public static function getSubscribedEvents()
  7.     {
  8.         return [
  9.             'news_entry.pre_delete' => 'onPreDelete',
  10.             'news_entry.post_delete' => 'onPostDelete'
  11.         ];
  12.     }
  13.     public function onPreDelete(PreDeleteEvent $event)
  14.     {
  15.         // $entry = $event->getEntry();
  16.         // 削除前に何かする
  17.     }
  18.     public function onPostDelete(PostDeleteEvent $event)
  19.     {
  20.         // $entry = $event->getEntry();
  21.         // 削除後に何かする
  22.     }
  23. }