public createContentTypeDraft ( $contentTypeId, |
||
$contentTypeId | ||
$request | ||
리턴 |
public function createContentTypeDraft($contentTypeId, Request $request)
{
$contentType = $this->contentTypeService->loadContentType($contentTypeId);
try {
$contentTypeDraft = $this->contentTypeService->createContentTypeDraft($contentType);
} catch (BadStateException $e) {
throw new ForbiddenException($e->getMessage());
}
$contentTypeUpdateStruct = $this->inputDispatcher->parse(new Message(array('Content-Type' => $request->headers->get('Content-Type')), $request->getContent()));
try {
$this->contentTypeService->updateContentTypeDraft($contentTypeDraft, $contentTypeUpdateStruct);
} catch (InvalidArgumentException $e) {
throw new ForbiddenException($e->getMessage());
}
return new Values\CreatedContentType(array('contentType' => new Values\RestContentType($this->contentTypeService->loadContentTypeDraft($contentTypeDraft->id))));
}