for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Victoire\Bundle\PageBundle\Helper;
use Symfony\Component\DependencyInjection\Container;
/**
* @author Paul Andrieux
*/
class UserCallableHelper
{
* @var Container
private $container;
* Constructor.
public function __construct(Container $container)
$this->container = $container;
}
* Get the current user.
*
* @return null
public function getCurrentUser()
$userClass = $this->container->getParameter('victoire_core.user_class');
$token = $this->container->get('security.context')->getToken();
if ($token !== null) {
if ($token->getUser() instanceof $userClass) {
return $token->getUser();