public function updateUser(User $user)
 {
     $plainPassword = $user->getPlainPassword();
     if (!empty($plainPassword)) {
         $encoder = $this->getEncoder($user);
         $user->setPassword($encoder->encodePassword($plainPassword, $user->getSalt()));
         $user->eraseCredentials();
     }
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $em = $this->getContainer()->get('doctrine')->getManager();
     $output->writeln('Creating administrator user');
     $admin = new User();
     $admin->setEmail('*****@*****.**');
     $admin->setFirstname('admin');
     $admin->setLastname('USER');
     $admin->setPlainPassword('admin');
     $admin->setIsPasswordExpired(true);
     $admin->setRole('ROLE_ADMIN');
     $admin->setIsActive(true);
     $em->persist($admin);
     $em->flush();
     $output->writeln('Done!');
 }