private function commentAction() { $name = $_POST['name']; $comment = $_POST['comment']; $iMark = $_POST['stars']; $productId = $_POST['product-id']; $oProduct = ProductManager::get($productId); $oUser = UserManager::getCurrent(); $oComment = new Comment(); $oComment->setDate(date('Y-m-d H:i:s')); $oComment->setMark($iMark); $oComment->setName($name); $oComment->setComment($comment); $oComment->setProduct($oProduct); $oComment->setUser($oUser); try { $result = CommentManager::create($oComment); } catch (\Exception $e) { $result = $e->getMessage(); } echo $result; }
private function validateAction() { $iId = intval($_GET['id']); $email = $_GET['email']; $oProduct = ProductManager::get($iId); $oUser = UserManager::getFromEmail($email); $oComment = CommentManager::get($oProduct, $oUser); $oComment = CommentManager::validate($oProduct, $oUser); }