public function logUser(User $user)
    {
        // TODO : log in an EventListener on user log event instead
        $this->strictEventDispatcher->dispatch('log', 'Log\LogUserLogin', [$user]);

        // TODO : nope, we should let Symfony handles token creation
        $token = new UsernamePasswordToken($user, null, 'main', $user->getRoles());
        $this->tokenStorage->setToken($token);

        if (null === $user->getInitDate()) {
            $this->setUserInitDate($user);
        }
        $user->setLastLogin(new \DateTime());

        $this->objectManager->persist($user);
        $this->objectManager->flush();
    }
public function logUser(User $user)
    {
        // TODO : log in an EventListener on user log event instead
        $this->strictEventDispatcher->dispatch('log', 'Log\LogUserLogin', [$user]);

        // TODO : nope, we should let Symfony handles token creation
        $token = new UsernamePasswordToken($user, null, 'main', $user->getRoles());
        $this->tokenStorage->setToken($token);

        if (null === $user->getInitDate()) {
            $this->setUserInitDate($user);
        }
        $user->setLastLogin(new \DateTime());

        $this->objectManager->persist($user);
        $this->objectManager->flush();
    }
public function logUser ( User $ user ) { // TODO : log in an EventListener on user log event instead $ this -> strictEventDispatcher -> dispatch ( 'log' , 'Log\LogUserLogin' , [ $ user ] ) ; // TODO : nope, we should let Symfony handles token creation $ token = new UsernamePasswordToken ( $ user , null , 'main' , $ user -> getRoles ( ) ) ; $ this -> tokenStorage -> setToken ( $ token ) ; if ( null === $ user -> getInitDate ( ) ) { $ this -> setUserInitDate ( $ user ) ; } $ user -> setLastLogin ( new \ DateTime ( ) ) ; $ this -> objectManager -> persist ( $ user ) ; $ this -> objectManager -> flush ( ) ; }
Logs the current user.
Logs the current user .