public function updatePost(Blog $blog, Post $existingPost, Post $post, User $user)
    {
        $existingPost
        ->setTitle($post->getTitle())
        ->setContent($post->getContent());
        if (null !== $post->getPublicationDate()) {
            $existingPost->setPublicationDate($post->getPublicationDate());
        } else {
            $existingPost->setPublicationDate(null);
        }

        $this->om->flush();

        $unitOfWork = $this->om->getUnitOfWork();
        $unitOfWork->computeChangeSets();
        $changeSet = $unitOfWork->getEntityChangeSet($existingPost);

        $this->trackingManager->dispatchPostUpdateEvent($existingPost, $changeSet);

        if ('anon.' !== $user) {
            $this->trackingManager->updateResourceTracking($blog->getResourceNode(), $user, new \DateTime());
        }

        return $existingPost;
    }
public function updatePost(Blog $blog, Post $existingPost, Post $post, User $user)
    {
        $existingPost
        ->setTitle($post->getTitle())
        ->setContent($post->getContent());
        if (null !== $post->getPublicationDate()) {
            $existingPost->setPublicationDate($post->getPublicationDate());
        } else {
            $existingPost->setPublicationDate(null);
        }

        $this->om->flush();

        $unitOfWork = $this->om->getUnitOfWork();
        $unitOfWork->computeChangeSets();
        $changeSet = $unitOfWork->getEntityChangeSet($existingPost);

        $this->trackingManager->dispatchPostUpdateEvent($existingPost, $changeSet);

        if ('anon.' !== $user) {
            $this->trackingManager->updateResourceTracking($blog->getResourceNode(), $user, new \DateTime());
        }

        return $existingPost;
    }
public function updatePost ( Blog $ blog , Post $ existingPost , Post $ post , User $ user ) { $ existingPost -> setTitle ( $ post -> getTitle ( ) ) -> setContent ( $ post -> getContent ( ) ) ; if ( null !== $ post -> getPublicationDate ( ) ) { $ existingPost -> setPublicationDate ( $ post -> getPublicationDate ( ) ) ; } else { $ existingPost -> setPublicationDate ( null ) ; } $ this -> om -> flush ( ) ; $ unitOfWork = $ this -> om -> getUnitOfWork ( ) ; $ unitOfWork -> computeChangeSets ( ) ; $ changeSet = $ unitOfWork -> getEntityChangeSet ( $ existingPost ) ; $ this -> trackingManager -> dispatchPostUpdateEvent ( $ existingPost , $ changeSet ) ; if ( 'anon.' !== $ user ) { $ this -> trackingManager -> updateResourceTracking ( $ blog -> getResourceNode ( ) , $ user , new \ DateTime ( ) ) ; } return $ existingPost ; }
Update a post.

@param Blog $blog
@param Post $existingPost
@param Post $post
@param User $user

@return Post
Update a post .