/** * Remove the random API token from the user. * * @param User $user */ public function deleteToken(User $user) { $user->setApiToken(null); $this->em->persist($user); $this->em->flush($user); }