/** * Save a new blog comment / voting * * @param $commentData * @param $blogArticleId */ protected function sSaveComment($commentData, $blogArticleId) { if (empty($commentData)) { Shopware()->System()->E_CORE_WARNING("sSaveComment #00", "Could not save comment"); return; } $commentData["creationDate"] = new \DateTime(); $commentData["active"] = 0; $blogCommentModel = new \Shopware\Models\Blog\Comment(); $commentData["blog"] = $this->getRepository()->find($this->Request()->blogArticle); $blogCommentModel->fromArray($commentData); Shopware()->Models()->persist($blogCommentModel); Shopware()->Models()->flush(); }
/** * 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(); }