src/Kunstmaan/NodeBundle/Helper/NodeAdmin/NodeAdminPublisher.php
public function createPublicVersion(
        HasNodeInterface $page,
        NodeTranslation $nodeTranslation,
        NodeVersion $nodeVersion,
        BaseUser $user
    ) {
        $newPublicPage = $this->cloneHelper->deepCloneAndSave($page);
        $newNodeVersion = $this->em->getRepository('KunstmaanNodeBundle:NodeVersion')->createNodeVersionFor(
            $newPublicPage,
            $nodeTranslation,
            $user,
            $nodeVersion
        );

        $newNodeVersion
            ->setOwner($nodeVersion->getOwner())
            ->setUpdated($nodeVersion->getUpdated())
            ->setCreated($nodeVersion->getCreated());

        $nodeVersion
            ->setOwner($user)
            ->setCreated(new \DateTime())
            ->setOrigin($newNodeVersion);

        $this->em->persist($newNodeVersion);
        $this->em->persist($nodeVersion);
        $this->em->persist($nodeTranslation);
        $this->em->flush();
        $this->eventDispatcher->dispatch(
            Events::CREATE_PUBLIC_VERSION,
            new NodeEvent($nodeTranslation->getNode(), $nodeTranslation, $nodeVersion, $newPublicPage)
        );

        return $newNodeVersion;
    }
public function createPublicVersion(
        HasNodeInterface $page,
        NodeTranslation $nodeTranslation,
        NodeVersion $nodeVersion,
        BaseUser $user
    ) {
        $newPublicPage = $this->cloneHelper->deepCloneAndSave($page);
        $newNodeVersion = $this->em->getRepository('KunstmaanNodeBundle:NodeVersion')->createNodeVersionFor(
            $newPublicPage,
            $nodeTranslation,
            $user,
            $nodeVersion
        );

        $newNodeVersion
            ->setOwner($nodeVersion->getOwner())
            ->setUpdated($nodeVersion->getUpdated())
            ->setCreated($nodeVersion->getCreated());

        $nodeVersion
            ->setOwner($user)
            ->setCreated(new \DateTime())
            ->setOrigin($newNodeVersion);

        $this->em->persist($newNodeVersion);
        $this->em->persist($nodeVersion);
        $this->em->persist($nodeTranslation);
        $this->em->flush();
        $this->eventDispatcher->dispatch(
            Events::CREATE_PUBLIC_VERSION,
            new NodeEvent($nodeTranslation->getNode(), $nodeTranslation, $nodeVersion, $newPublicPage)
        );

        return $newNodeVersion;
    }
public function createPublicVersion ( HasNodeInterface $ page , NodeTranslation $ nodeTranslation , NodeVersion $ nodeVersion , BaseUser $ user ) { $ newPublicPage = $ this -> cloneHelper -> deepCloneAndSave ( $ page ) ; $ newNodeVersion = $ this -> em -> getRepository ( 'KunstmaanNodeBundle:NodeVersion' ) -> createNodeVersionFor ( $ newPublicPage , $ nodeTranslation , $ user , $ nodeVersion ) ; $ newNodeVersion -> setOwner ( $ nodeVersion -> getOwner ( ) ) -> setUpdated ( $ nodeVersion -> getUpdated ( ) ) -> setCreated ( $ nodeVersion -> getCreated ( ) ) ; $ nodeVersion -> setOwner ( $ user ) -> setCreated ( new \ DateTime ( ) ) -> setOrigin ( $ newNodeVersion ) ; $ this -> em -> persist ( $ newNodeVersion ) ; $ this -> em -> persist ( $ nodeVersion ) ; $ this -> em -> persist ( $ nodeTranslation ) ; $ this -> em -> flush ( ) ; $ this -> eventDispatcher -> dispatch ( Events :: CREATE_PUBLIC_VERSION , new NodeEvent ( $ nodeTranslation -> getNode ( ) , $ nodeTranslation , $ nodeVersion , $ newPublicPage ) ) ; return $ newNodeVersion ; }
This shouldn't be here either but it's an improvement.

@param HasNodeInterface $page            The page
@param NodeTranslation  $nodeTranslation The node translation
@param NodeVersion      $nodeVersion     The node version
@param BaseUser         $user            The user

@return mixed
This shouldn t be here either but it s an improvement .