<?php
namespace App\Twig\Globals;
class ClientHelper {
public function __construct(
\App\Repository\UserRepository $userRepository,
\Symfony\Component\Security\Core\Security $security,
\Symfony\Component\Routing\Generator\UrlGeneratorInterface $router
) {
$this->router = $router;
$this->security = $security;
$this->userRepository = $userRepository;
}
public function getClient() {
$client = null;
if ($this->security->getUser())
$client = $this->userRepository->findOneBy(['email' => $this->security->getUser()->getUserIdentifier()]);
return $client;
}
}