Bundle/BlogBundle/Manager/ArticleManager.php
public function create(Article $article, User $author)
    {
        $article->setAuthor($author);

        /** @var Tag[] $tags */
        $tags = $article->getTags();
        if (is_array($tags)) {
            foreach ($tags as $tag) {
                $tag->setBlog($article->getBlog());
                $this->entityManager->persist($tag);
            }
        }

        //Article has to be persisted before BusinessPage generation
        $this->entityManager->persist($article);
        $this->entityManager->flush();

        $page = $this->businessPageBuilder->generateEntityPageFromTemplate(
            $article->getTemplate(),
            $article,
            $this->entityManager
        );

        //Transform VBP into BP
        $this->virtualToBusinessPageTransformer->transform($page);
        $page->setParent($article->getBlog());
        $page->setStatus($article->getStatus());

        $this->entityManager->persist($page);
        $this->entityManager->flush();

        return $page;
    }
public function create(Article $article, User $author)
    {
        $article->setAuthor($author);

        /** @var Tag[] $tags */
        $tags = $article->getTags();
        if (is_array($tags)) {
            foreach ($tags as $tag) {
                $tag->setBlog($article->getBlog());
                $this->entityManager->persist($tag);
            }
        }

        //Article has to be persisted before BusinessPage generation
        $this->entityManager->persist($article);
        $this->entityManager->flush();

        $page = $this->businessPageBuilder->generateEntityPageFromTemplate(
            $article->getTemplate(),
            $article,
            $this->entityManager
        );

        //Transform VBP into BP
        $this->virtualToBusinessPageTransformer->transform($page);
        $page->setParent($article->getBlog());
        $page->setStatus($article->getStatus());

        $this->entityManager->persist($page);
        $this->entityManager->flush();

        return $page;
    }
public function create ( Article $ article , User $ author ) { $ article -> setAuthor ( $ author ) ; /** @var Tag[] $tags */ $ tags = $ article -> getTags ( ) ; if ( is_array ( $ tags ) ) { foreach ( $ tags as $ tag ) { $ tag -> setBlog ( $ article -> getBlog ( ) ) ; $ this -> entityManager -> persist ( $ tag ) ; } } //Article has to be persisted before BusinessPage generation $ this -> entityManager -> persist ( $ article ) ; $ this -> entityManager -> flush ( ) ; $ page = $ this -> businessPageBuilder -> generateEntityPageFromTemplate ( $ article -> getTemplate ( ) , $ article , $ this -> entityManager ) ; //Transform VBP into BP $ this -> virtualToBusinessPageTransformer -> transform ( $ page ) ; $ page -> setParent ( $ article -> getBlog ( ) ) ; $ page -> setStatus ( $ article -> getStatus ( ) ) ; $ this -> entityManager -> persist ( $ page ) ; $ this -> entityManager -> flush ( ) ; return $ page ; }
Create Article with its author, tags.
Create BusinessPage for this Article.

@param Article $article
@param User    $author

@return BusinessPage
Create Article with its author tags . Create BusinessPage for this Article .