I'm trying to logout my user, getting it's token (which is existing and working) like this:
public function logout(Request $request, TokenStorageInterface $tokenStorage)
{
$em = $this->get('doctrine.orm.entity_manager');
$user = $this->getUser();
$user->setConnected(false);
$em->remove($tokenStorage->getToken()); // Error is here
$em->persist($user);
$em->flush();
}
When I request this method, I get the folowing error:
The class 'Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken' was not found in the chain configured namespaces App\Entity
I tried to search on google and SO but didn't find any related thread, as this class is not an entity.
I tried to include a "use" statement on top of my controller, but that didn't do the trick.
What am I doing wrong ?
Thanks to anyone who will take the time to read or answer this.