/**
  * Convert a User array into a User object.
  *
  * @param array $aUser User.
  *
  * @return User converted object.
  */
 private static function convertToObject($aUser)
 {
     $oUser = new User();
     $oUser->setEmail($aUser['email']);
     $oUser->setPassword($aUser['password']);
     $oUser->setAddress($aUser['address']);
     $oUser->setName($aUser['name']);
     $oUser->setFirstName($aUser['firstname']);
     $oUser->setCp($aUser['cp']);
     $oUser->setCity($aUser['city']);
     $oUser->setRole($aUser['role']);
     return $oUser;
 }
 private function subscriptionAction()
 {
     $oUser = new User();
     $oUser->setEmail($_POST['email']);
     $oUser->setPassword($_POST['password']);
     $oUser->setAddress($_POST['address']);
     $oUser->setName($_POST['name']);
     $oUser->setFirstname($_POST['firstname']);
     $oUser->setCp($_POST['cp']);
     $oUser->setCity($_POST['city']);
     if (UserManager::subscribe($oUser)) {
         echo 'Inscription ok!';
         $_SESSION['email'] = $oUser->getEmail();
         $this->homeAction();
     } else {
         $bSubscribeError = true;
         require ROOT . 'src/ecommerce/view/login/login.php';
     }
 }