eZ\Publish\Core\REST\Server\Controller\Content::copyContent PHP 메소드

copyContent() 공개 메소드

Creates a new content object as copy under the given parent location given in the destination header.
public copyContent ( mixed $contentId, Request $request ) : ResourceCreated
$contentId mixed
$request Symfony\Component\HttpFoundation\Request
리턴 eZ\Publish\Core\REST\Server\Values\ResourceCreated
    public function copyContent($contentId, Request $request)
    {
        $destination = $request->headers->get('Destination');
        $parentLocationParts = explode('/', $destination);
        $copiedContent = $this->repository->getContentService()->copyContent($this->repository->getContentService()->loadContentInfo($contentId), $this->repository->getLocationService()->newLocationCreateStruct(array_pop($parentLocationParts)));
        return new Values\ResourceCreated($this->router->generate('ezpublish_rest_loadContent', array('contentId' => $copiedContent->id)));
    }