| @@ 3178-3199 (lines=22) @@ | ||
| 3175 | * |
|
| 3176 | * @return \eZ\Publish\API\Repository\Values\Content\Content published Content |
|
| 3177 | */ |
|
| 3178 | private function publishContentWithParentLocation($contentName, $parentLocationId) |
|
| 3179 | { |
|
| 3180 | $repository = $this->getRepository(false); |
|
| 3181 | $locationService = $repository->getLocationService(); |
|
| 3182 | ||
| 3183 | $contentService = $repository->getContentService(); |
|
| 3184 | $contentTypeService = $repository->getContentTypeService(); |
|
| 3185 | ||
| 3186 | $contentCreateStruct = $contentService->newContentCreateStruct( |
|
| 3187 | $contentTypeService->loadContentTypeByIdentifier('folder'), |
|
| 3188 | 'eng-US' |
|
| 3189 | ); |
|
| 3190 | $contentCreateStruct->setField('name', $contentName); |
|
| 3191 | $contentDraft = $contentService->createContent( |
|
| 3192 | $contentCreateStruct, |
|
| 3193 | [ |
|
| 3194 | $locationService->newLocationCreateStruct($parentLocationId), |
|
| 3195 | ] |
|
| 3196 | ); |
|
| 3197 | ||
| 3198 | return $contentService->publishVersion($contentDraft->versionInfo); |
|
| 3199 | } |
|
| 3200 | ||
| 3201 | /** |
|
| 3202 | * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException |
|
| @@ 1056-1071 (lines=16) @@ | ||
| 1053 | * |
|
| 1054 | * @return \eZ\Publish\API\Repository\Values\Content\Content |
|
| 1055 | */ |
|
| 1056 | protected function createNewContentInPlaceTrashedOne(Repository $repository, $parentLocationId) |
|
| 1057 | { |
|
| 1058 | $contentService = $repository->getContentService(); |
|
| 1059 | $locationService = $repository->getLocationService(); |
|
| 1060 | $contentTypeService = $repository->getContentTypeService(); |
|
| 1061 | ||
| 1062 | $contentType = $contentTypeService->loadContentTypeByIdentifier('forum'); |
|
| 1063 | $newContent = $contentService->newContentCreateStruct($contentType, 'eng-US'); |
|
| 1064 | $newContent->setField('name', 'Media'); |
|
| 1065 | ||
| 1066 | $location = $locationService->newLocationCreateStruct($parentLocationId); |
|
| 1067 | ||
| 1068 | $draftContent = $contentService->createContent($newContent, [$location]); |
|
| 1069 | ||
| 1070 | return $contentService->publishVersion($draftContent->versionInfo); |
|
| 1071 | } |
|
| 1072 | ||
| 1073 | /** |
|
| 1074 | * @param URLAliasService $urlAliasService |
|