Exemplo n.º 1
0
    /**
     * 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();
    }