| @@ 97-118 (lines=22) @@ | ||
| 94 | /** |
|
| 95 | * @return Content |
|
| 96 | */ |
|
| 97 | private function createFolder() |
|
| 98 | { |
|
| 99 | $repository = $this->getRepository(); |
|
| 100 | $contentService = $repository->getContentService(); |
|
| 101 | $contentTypeService = $repository->getContentTypeService(); |
|
| 102 | $locationService = $repository->getLocationService(); |
|
| 103 | ||
| 104 | $struct = $contentService->newContentCreateStruct( |
|
| 105 | $contentTypeService->loadContentTypeByIdentifier('folder'), |
|
| 106 | 'eng-GB' |
|
| 107 | ); |
|
| 108 | ||
| 109 | $struct->setField('name', uniqid('Query Controller BDD ', true)); |
|
| 110 | ||
| 111 | $contentDraft = $contentService->createContent( |
|
| 112 | $struct, |
|
| 113 | [$locationService->newLocationCreateStruct(2)] |
|
| 114 | ); |
|
| 115 | $contentService->publishVersion($contentDraft->versionInfo); |
|
| 116 | ||
| 117 | return $contentService->loadContent($contentDraft->id); |
|
| 118 | } |
|
| 119 | ||
| 120 | /** |
|
| 121 | * @Given /^a LocationChildren QueryType defined in "([^"]*)":$/ |
|
| @@ 2907-2928 (lines=22) @@ | ||
| 2904 | * |
|
| 2905 | * @return \eZ\Publish\API\Repository\Values\Content\Content published Content |
|
| 2906 | */ |
|
| 2907 | private function publishContentWithParentLocation($contentName, $parentLocationId) |
|
| 2908 | { |
|
| 2909 | $repository = $this->getRepository(false); |
|
| 2910 | $locationService = $repository->getLocationService(); |
|
| 2911 | ||
| 2912 | $contentService = $repository->getContentService(); |
|
| 2913 | $contentTypeService = $repository->getContentTypeService(); |
|
| 2914 | ||
| 2915 | $contentCreateStruct = $contentService->newContentCreateStruct( |
|
| 2916 | $contentTypeService->loadContentTypeByIdentifier('folder'), |
|
| 2917 | 'eng-US' |
|
| 2918 | ); |
|
| 2919 | $contentCreateStruct->setField('name', $contentName); |
|
| 2920 | $contentDraft = $contentService->createContent( |
|
| 2921 | $contentCreateStruct, |
|
| 2922 | [ |
|
| 2923 | $locationService->newLocationCreateStruct($parentLocationId), |
|
| 2924 | ] |
|
| 2925 | ); |
|
| 2926 | ||
| 2927 | return $contentService->publishVersion($contentDraft->versionInfo); |
|
| 2928 | } |
|
| 2929 | } |
|
| 2930 | ||
| @@ 960-975 (lines=16) @@ | ||
| 957 | * |
|
| 958 | * @return \eZ\Publish\API\Repository\Values\Content\Content |
|
| 959 | */ |
|
| 960 | protected function createNewContentInPlaceTrashedOne(Repository $repository, $parentLocationId) |
|
| 961 | { |
|
| 962 | $contentService = $repository->getContentService(); |
|
| 963 | $locationService = $repository->getLocationService(); |
|
| 964 | $contentTypeService = $repository->getContentTypeService(); |
|
| 965 | ||
| 966 | $contentType = $contentTypeService->loadContentTypeByIdentifier('forum'); |
|
| 967 | $newContent = $contentService->newContentCreateStruct($contentType, 'eng-US'); |
|
| 968 | $newContent->setField('name', 'Media'); |
|
| 969 | ||
| 970 | $location = $locationService->newLocationCreateStruct($parentLocationId); |
|
| 971 | ||
| 972 | $draftContent = $contentService->createContent($newContent, [$location]); |
|
| 973 | ||
| 974 | return $contentService->publishVersion($draftContent->versionInfo); |
|
| 975 | } |
|
| 976 | ||
| 977 | /** |
|
| 978 | * @param URLAliasService $urlAliasService |
|