Exemple #1
0
 /**
  * Save a new blog comment / voting
  *
  * @param array $commentData
  * @param int $blogArticleId
  * @throws Enlight_Exception
  */
 protected function sSaveComment($commentData, $blogArticleId)
 {
     if (empty($commentData)) {
         throw new Enlight_Exception("sSaveComment #00: Could not save comment");
     }
     $blogCommentModel = new \Shopware\Models\Blog\Comment();
     $blog = $this->getRepository()->find($blogArticleId);
     $blogCommentModel->setBlog($blog);
     $blogCommentModel->setCreationDate(new \DateTime());
     $blogCommentModel->setActive(false);
     $blogCommentModel->setName($commentData['name']);
     $blogCommentModel->setEmail($commentData['eMail']);
     $blogCommentModel->setHeadline($commentData['headline']);
     $blogCommentModel->setComment($commentData['comment']);
     $blogCommentModel->setPoints($commentData['points']);
     Shopware()->Models()->persist($blogCommentModel);
     Shopware()->Models()->flush();
 }