src/Aqarmap/Bundle/UserBundle/EventListener/ParentLogoApprovedEventSubscriber.php line 33
<?phpnamespace Aqarmap\Bundle\UserBundle\EventListener;use Aqarmap\Bundle\UserBundle\Entity\User;use Aqarmap\Bundle\UserBundle\Event\ParentLogoApprovedEvent;use Doctrine\ORM\EntityManagerInterface;use FOS\UserBundle\Model\UserManager;use Symfony\Component\EventDispatcher\EventSubscriberInterface;class ParentLogoApprovedEventSubscriber implements EventSubscriberInterface{/*** UserManager constructor.*/public function __construct(private readonly EntityManagerInterface $em){}public static function getSubscribedEvents(): array{return [ParentLogoApprovedEvent::NAME => 'onParentLogoApproved',];}public function onParentLogoApproved(ParentLogoApprovedEvent $event): void{/*** @var User $subAccount*/foreach ($event->getSubAccounts() as $subAccount) {$subAccount->setLogo($event->getLogo());$subAccount->setIsValidLogo(true);$this->em->persist($subAccount);}$this->em->flush();}}