private function connectionAction() { $oUser = new User(); $oUser->setEmail($_POST['email']); $oUser->setPassword($_POST['password']); if (UserManager::connect($oUser)) { //header('location: index.php'); header('location: index.php'); } else { $bConnectError = true; require ROOT . 'src/ecommerce/view/login/login.php'; } }
/** * Convert a Comment array into a Comment object. * * @param array $aComment Comment. * * @return Comment converted object. */ private static function convertToObject($aComment) { $oComment = new Comment(); $oComment->setComment($aComment['comment']); $oComment->setMark(intval($aComment['mark'])); $oComment->setDate($aComment['date']); $oComment->setName($aComment['name']); $oUser = new User(); $oUser->setEmail($aComment['user_email']); $oComment->setUser(UserManager::get($oUser)); $oComment->setProduct(ProductManager::get($aComment['product_id'])); return $oComment; }
public static function getCurrent() { if (!array_key_exists('email', $_SESSION)) { return null; } $oUser = new User(); $oUser->setEmail($_SESSION['email']); return self::get($oUser); }