public static function create(Comment $oComment)
 {
     $sQuery = 'insert into comment(product_id,name, user_email,comment,mark,date) values(';
     $sQuery .= "'{$oComment->getProduct()->getId()}', '{$oComment->getName()}','{$oComment->getUser()->getEmail()}','{$oComment->getComment()}','{$oComment->getMark()}','{$oComment->getDate()}'";
     $sQuery .= ')';
     $iRetExec = DBOperation::exec($sQuery);
     if (null !== ($sLastSqlError = DBOperation::getLastSqlError())) {
         throw new \Exception($sLastSqlError);
     }
 }
 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;
 }