Do Subscribers work while loading Fixtures in Symfony?
Solution 1:
EasyCorp\Bundle\EasyAdminBundle\Event\BeforeEntityPersistedEvent:class
is not proper Symfony event name. You probably should use Doctrine\ORM\Events::prePersist
.
Also please check your DoctrineBundle version. If you're using the default services.yaml configuration and DoctrineBundle lower than 2.1, you have to configure services.yaml
with:
App\EventListener\AuthorSubscriber:
tags:
- name: 'doctrine.event_subscriber'
You can read something more here: https://symfony.com/doc/current/doctrine/events.html#doctrine-lifecycle-subscribers