<?php
declare(strict_types=1);
namespace Harmonizely\EventSubscriber;
use FOS\UserBundle\Event\GetResponseUserEvent;
use FOS\UserBundle\FOSUserEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Harmonizely\Calendar\Connector\InternalCalendarConnectorInterface;
class CreateInternalCalendarSubscriber implements EventSubscriberInterface
{
/**
* @var InternalCalendarConnectorInterface
*/
private InternalCalendarConnectorInterface $internalCalendarConnector;
/**
* @param InternalCalendarConnectorInterface $internalCalendarConnector
*/
public function __construct(InternalCalendarConnectorInterface $internalCalendarConnector)
{
$this->internalCalendarConnector = $internalCalendarConnector;
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents(): array
{
return [
FOSUserEvents::REGISTRATION_CONFIRM => 'createInternalCalendar',
];
}
/**
* @param GetResponseUserEvent $event
* @return void
*/
public function createInternalCalendar(GetResponseUserEvent $event): void
{
$this->internalCalendarConnector->connect($event->getUser());
}
}