/**
  * {@inheritDoc}
  */
 public function getSalt()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getSalt', []);
     return parent::getSalt();
 }
     } else {
         $view->setData('User don\'t delete')->setStatusCode(404);
     }
     return $view;
 }
 /**
  * Return an user identified by login/password.
  * @Get("/users/check_session/username={username}&password={password}")
  * @param $username
  * @param $password
  * @return View
  */
 public function checkSessionAction($username, $password)
 {
     $em = $this->getDoctrine()->getManager();
     $user = $em->getRepository('UserBundle:User')->findOneByUsername($username);
     if ($user) {
         $encoder = $this->container->get('security.encoder_factory')->getEncoder($user);
         if ($encoder->encodePassword($password, $user->getSalt()) === $user->getPassword()) {
             return $user;
         }
     }
     return array();
 }