/** * Activates a User and set the init date to now. */ public function activateUser(User $user) { $user->setIsEnabled(true); $user->setIsMailValidated(true); $user->setResetPasswordHash(null); $user->setInitDate(new \DateTime()); $this->objectManager->persist($user); $this->objectManager->flush(); }