<?php
namespace App\Event\News\Category;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class PersistSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
return [
'news_category.pre_persist' => 'onPrePersist',
'news_category.post_persist' => 'onPostPersist'
];
}
public function onPrePersist(PrePersistEvent $event)
{
// $category = $event->getCategory();
// $isCreated = $event->isCreate();
}
public function onPostPersist(PostPersistEvent $event)
{
// $category = $event->getCategory();
// $isCreate = $event->isCreate();
}
}