setBlog example


        if (empty($commentData)) {
            throw new Enlight_Exception('sSaveComment #00: Could not save comment');
        }

        $blogCommentModel = new Comment();
        /** @var Blog $blog */
        $blog = $this->getRepository()->find($blogArticleId);
        /** @var Shop $shop */
        $shop = $this->getModelManager()->getReference(Shop::class$this->get('shop')->getId());

        $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']);
        $blogCommentModel->setShop($shop);

        $this->get('models')->persist($blogCommentModel);
        

    protected function prepareTagAssociatedData($data$blogModel)
    {
        $tags = explode(',', $data['tags']);
        foreach ($tags as $tag) {
            if (!empty($tag)) {
                $tagModel = new Tag();
                $tagModel->setName($tag);
                $tagModel->setBlog($blogModel);
                $this->getManager()->persist($tagModel);
            }
        }
    }

    /** * This method prepares the media data for saving it directly to the blog model * * @param array $mediaData * * @return array */


        if (isset($data['__category_cmstext'])) {
            $category->setCmsText($data['__category_cmstext']);
        }

        if (isset($data['__category_template'])) {
            $category->setTemplate($data['__category_template']);
        }

        if (isset($data['__category_blog'])) {
            $category->setBlog((bool) $data['__category_blog']);
        }

        if (isset($data['__category_external'])) {
            $category->setExternalLink($data['__category_external']);
        }

        if (isset($data['__category_external_target'])) {
            $category->setExternalTarget($data['__category_external_target']);
        }

        if (isset($data['__category_hidefilter'])) {
            
Home | Imprint | This part of the site doesn't use cookies.