<?php
namespace App\EventListener\Client\Customer;
use App\Entity\Client\Customer\Customer;
use App\EventListener\GenericEvent;
use App\Model\Client\Customer\CustomerLoginModel;
use App\Service\Client\Customer\CustomerManager;
class CustomerListener
{
private CustomerManager $customerManager;
public function __construct(CustomerManager $customerManager)
{
$this->customerManager = $customerManager;
}
public function register(GenericEvent $genericEvent)
{
if (!$genericEvent->getSubject() instanceof Customer) return;
$this->customerManager->register($genericEvent);
}
public function login(GenericEvent $genericEvent)
{
if (!$genericEvent->getSubject() instanceof CustomerLoginModel) return;
$this->customerManager->login($genericEvent);
}
public function update(GenericEvent $genericEvent)
{
if (!$genericEvent->getSubject() instanceof Customer) return;
$this->customerManager->update($genericEvent);
}
}