| @@ 58-76 (lines=19) @@ | ||
| 55 | * |
|
| 56 | * @return \eZ\Publish\Core\REST\Server\Values\CreatedContentTypeGroup |
|
| 57 | */ |
|
| 58 | public function createContentTypeGroup(Request $request) |
|
| 59 | { |
|
| 60 | $createStruct = $this->inputDispatcher->parse( |
|
| 61 | new Message( |
|
| 62 | array('Content-Type' => $request->headers->get('Content-Type')), |
|
| 63 | $request->getContent() |
|
| 64 | ) |
|
| 65 | ); |
|
| 66 | ||
| 67 | try { |
|
| 68 | return new Values\CreatedContentTypeGroup( |
|
| 69 | array( |
|
| 70 | 'contentTypeGroup' => $this->contentTypeService->createContentTypeGroup($createStruct), |
|
| 71 | ) |
|
| 72 | ); |
|
| 73 | } catch (InvalidArgumentException $e) { |
|
| 74 | throw new ForbiddenException($e->getMessage()); |
|
| 75 | } |
|
| 76 | } |
|
| 77 | ||
| 78 | /** |
|
| 79 | * Updates a content type group. |
|
| @@ 63-83 (lines=21) @@ | ||
| 60 | * |
|
| 61 | * @return \eZ\Publish\Core\REST\Server\Values\CreatedObjectStateGroup |
|
| 62 | */ |
|
| 63 | public function createObjectStateGroup(Request $request) |
|
| 64 | { |
|
| 65 | try { |
|
| 66 | $createdStateGroup = $this->objectStateService->createObjectStateGroup( |
|
| 67 | $this->inputDispatcher->parse( |
|
| 68 | new Message( |
|
| 69 | array('Content-Type' => $request->headers->get('Content-Type')), |
|
| 70 | $request->getContent() |
|
| 71 | ) |
|
| 72 | ) |
|
| 73 | ); |
|
| 74 | } catch (InvalidArgumentException $e) { |
|
| 75 | throw new ForbiddenException($e->getMessage()); |
|
| 76 | } |
|
| 77 | ||
| 78 | return new Values\CreatedObjectStateGroup( |
|
| 79 | array( |
|
| 80 | 'objectStateGroup' => $createdStateGroup, |
|
| 81 | ) |
|
| 82 | ); |
|
| 83 | } |
|
| 84 | ||
| 85 | /** |
|
| 86 | * Creates a new object state. |
|
| @@ 84-104 (lines=21) @@ | ||
| 81 | * |
|
| 82 | * @return \eZ\Publish\Core\REST\Server\Values\CreatedSection |
|
| 83 | */ |
|
| 84 | public function createSection(Request $request) |
|
| 85 | { |
|
| 86 | try { |
|
| 87 | $createdSection = $this->sectionService->createSection( |
|
| 88 | $this->inputDispatcher->parse( |
|
| 89 | new Message( |
|
| 90 | array('Content-Type' => $request->headers->get('Content-Type')), |
|
| 91 | $request->getContent() |
|
| 92 | ) |
|
| 93 | ) |
|
| 94 | ); |
|
| 95 | } catch (InvalidArgumentException $e) { |
|
| 96 | throw new ForbiddenException($e->getMessage()); |
|
| 97 | } |
|
| 98 | ||
| 99 | return new Values\CreatedSection( |
|
| 100 | array( |
|
| 101 | 'section' => $createdSection, |
|
| 102 | ) |
|
| 103 | ); |
|
| 104 | } |
|
| 105 | ||
| 106 | /** |
|
| 107 | * Loads a section. |
|