From a9353c457242c889bfd2ac0f19fc0c165c658622 Mon Sep 17 00:00:00 2001 From: Vidar Langseid Date: Mon, 12 May 2025 15:56:24 +0200 Subject: [PATCH 1/6] IBX-9446: [BO] Fatal error after non-translatable field added to Content Type --- src/lib/Persistence/Legacy/Content/FieldHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/Persistence/Legacy/Content/FieldHandler.php b/src/lib/Persistence/Legacy/Content/FieldHandler.php index 892608c25c..6a5dbfafdc 100644 --- a/src/lib/Persistence/Legacy/Content/FieldHandler.php +++ b/src/lib/Persistence/Legacy/Content/FieldHandler.php @@ -334,10 +334,10 @@ public function updateFields(Content $content, UpdateStruct $updateStruct, Type $field->versionNo = $content->versionInfo->versionNo; if (isset($field->id) && array_key_exists($field->languageCode, $existingLanguageCodes)) { $this->updateField($field, $content); - $updatedFields[$fieldDefinition->id][$languageCode] = $field; } else { $this->createNewField($field, $content); } + $updatedFields[$fieldDefinition->id][$languageCode] = $field; } elseif (!isset($existingLanguageCodes[$languageCode])) { // If field is not set for new language if ($fieldDefinition->isTranslatable) { From b6a24bfedc5d44bf14ae146f91981c175172d0da Mon Sep 17 00:00:00 2001 From: Vidar Langseid Date: Thu, 15 May 2025 11:03:17 +0200 Subject: [PATCH 2/6] fixup! IBX-9446: [BO] Fatal error after non-translatable field added to Content Type - Added testcase --- .../Persistence/Legacy/FileHandlerTest.php | 228 ++++++++++++++++++ 1 file changed, 228 insertions(+) create mode 100644 tests/integration/Core/Persistence/Legacy/FileHandlerTest.php diff --git a/tests/integration/Core/Persistence/Legacy/FileHandlerTest.php b/tests/integration/Core/Persistence/Legacy/FileHandlerTest.php new file mode 100644 index 0000000000..2c416027f9 --- /dev/null +++ b/tests/integration/Core/Persistence/Legacy/FileHandlerTest.php @@ -0,0 +1,228 @@ +getRepository(); +// $contentTypeService = $repository->getContentTypeService(); +// $contentService = $repository->getContentService(); +// $permissionResolver = $repository->getPermissionResolver(); + + + + // Create new ContentType + var_dump("SSSSSSSSSSSSSSSSTTTTTTTTTAAAAAAAAAARRRRRRRRRRRTTTTTTTTTTTTTTT"); + $fieldDefCreateStruct = $this->createFieldDefinitionStruct('name', 'Name', true); + + $contentTypeCreateStruct = $this->createTypeCreateStruct(); + $contentTypeCreateStruct->addFieldDefinition($fieldDefCreateStruct); + + $contentType = $contentTypeService->createContentType($contentTypeCreateStruct, [ + $contentTypeService->loadContentTypeGroupByIdentifier('Content'), + ]); + + $contentTypeService->publishContentTypeDraft($contentType); + + + // Create content, with two translations + $content = $this->createNewContent('Some Content', ['eng-GB', 'ger-DE']); + + // Create draft in each translation + $content = $contentService->loadContent($content->getId(), ['eng-GB']); + $engUpdateStruct = $this->createUpdateStruct($content, '', ['eng-GB']); + $engDraft = $this->createContentDraft($content, 'eng-GB'); + $engDraft = $this->updateContent($engDraft, $engUpdateStruct); +// $content = $contentService->loadContent($content->getId(), ['ger-DE']); +// $gerUpdateStruct = $this->createUpdateStruct($content, '', ['ger-DE']); +// $gerDraft = $this->createContentDraft($content, 'ger-DE');; +// $gerDraft = $this->updateContent($gerDraft, $gerUpdateStruct); + +// $gerContent = $this->createDraft($content->getId(), '', ['ger-DE']); +// $gerContent = $this->createDraft($content->getId(), '', ['ger-DE']); + + + // Create new non-translatable field + $contentType = $contentTypeService->loadContentTypeByIdentifier('multi_lang_drafts'); + $contentTypeDraft = $contentTypeService->createContentTypeDraft($contentType); + $fieldDefCreateStruct = $this->createFieldDefinitionStruct('non_trans_field', 'Non translatable field', false); + $contentTypeService->addFieldDefinition($contentTypeDraft, $fieldDefCreateStruct); + + $contentTypeService->publishContentTypeDraft($contentTypeDraft); + + // Update eng-GB draft + var_dump("PPPPPUUUBBBBBLISH", get_class($engUpdateStruct)); + // Ibexa\Core\Event\ContentService vs Ibexa\Core\Repository\SiteAccessAware\ContentService + $engUpdateStruct->setField('non_trans_field', '', 'eng-GB'); + $this->updateContent($engDraft, $engUpdateStruct); + //$contentService->updateContent($engContent->getVersionInfo(), $contentService->newContentUpdateStruct()); + //$contentService->publishVersion($engContent->versionInfo); + + + //$creatorId = $this->generateId('user', $permissionResolver->getCurrentUserReference()->getUserId()); + + + + var_dump("kake"); + } + + private function createFieldDefinitionStruct(string $identifier, string $name, bool $isTranslatable): FieldDefinitionCreateStruct + { + $contentTypeService = self::getContentTypeService(); + +// $repository = $this->getRepository(); +// $contentTypeService = $repository->getContentTypeService(); + + $fieldDefCreateStruct = $contentTypeService->newFieldDefinitionCreateStruct( + $identifier, + 'ezstring' + ); + + $fieldDefCreateStruct->names = ['eng-GB' => $name]; + $fieldDefCreateStruct->descriptions = [ + 'eng-GB' => '', + ]; + $fieldDefCreateStruct->isTranslatable = $isTranslatable; + + return $fieldDefCreateStruct; + } + + private function createTypeCreateStruct(): ContentTypeCreateStruct { + $contentTypeService = self::getContentTypeService(); + $permissionResolver = self::getPermissionResolver(); + +// $repository = $this->getRepository(); +// $contentTypeService = $repository->getContentTypeService(); +// $permissionResolver = $repository->getPermissionResolver(); + + //$creatorId = $this->generateId('user', $permissionResolver->getCurrentUserReference()->getUserId()); + + $typeCreateStruct = $contentTypeService->newContentTypeCreateStruct('multi_lang_drafts'); + $typeCreateStruct->mainLanguageCode = 'eng-GB'; + $typeCreateStruct->names = ['eng-GB' => 'Multi lang drafts']; + //$typeCreateStruct->creatorId = $creatorId; + //$typeCreateStruct->creationDate = $this->createDateTime(); + + return $typeCreateStruct; + } + + protected function createNewContent(string $name, array $languages = ['eng-GB'], int $parentLocationId = 2, ): Content + { + $contentTypeService = self::getContentTypeService(); + $contentService = self::getContentService(); + $locationService = self::getLocationService(); +// $repository = $this->getRepository(); +// $contentTypeService = $repository->getContentTypeService(); +// $contentService = $repository->getContentService(); +// $locationService = $repository->getLocationService(); + + $contentType = $contentTypeService->loadContentTypeByIdentifier('multi_lang_drafts'); + $createStruct = $contentService->newContentCreateStruct($contentType, $languages[0]); + + foreach ($languages as $language) { + $createStruct->setField('name', "[$language]" . $name, $language); + } + $locationCreateStruct = $locationService->newLocationCreateStruct($parentLocationId); + + $draft = $contentService->createContent($createStruct, [$locationCreateStruct]); + + return $contentService->publishVersion($draft->versionInfo); + } + + protected function createUpdateStruct(Content $content, string $translatedName, array $languages ) + { + $contentService = self::getContentService(); +// $repository = $this->getRepository(); +// $contentService = $repository->getContentService(); + + //$content = $contentService->loadContent($contentId); + + $updateStruct = $contentService->newContentUpdateStruct(); + $updateStruct->initialLanguageCode = $languages[0]; + + if ($translatedName === '') { + $translatedNameOrg = $content->getName(); + } else { + $translatedNameOrg = $translatedName; + } + + /** Need to use $languiage param? */ + //$draft = $contentService->createContentDraft($content->contentInfo); + foreach ($languages as $language) { + $translatedName = "[$language]" . $translatedNameOrg; + + //$updateStruct->initialLanguageCode = $newLanguage; + $updateStruct->setField('name', $translatedName, $language); + } + return $updateStruct; +// $updatedContent = $contentService->updateContent($draft->versionInfo,$updateStruct); +// +// return $updatedContent; + //return $contentService->publishVersion($updatedContent->versionInfo); +// $this->output->writeln("Translated content: '$translatedName' with contentId=" . $content->getId() . ' and locationId=' . $content->contentInfo->mainLocationId . ' to language(s) : ' . implode(', ', $languages)); + + } + + protected function createContentDraft(Content $content, string $languageCode): Content + { + $contentService = self::getContentService(); + $contentLanguageService = self::getLanguageService(); +// $repository = $this->getRepository(); +// $contentService = $repository->getContentService(); +// $contentLanguageService = $repository->getContentLanguageService(); + + $language = $contentLanguageService->loadLanguage($languageCode); + $draft = $contentService->createContentDraft($content->contentInfo, null, null, $language); + return $draft; + } + + protected function updateContent(Content $draft, ContentUpdateStruct $updateStruct/*, array $languages*/): Content + { + $contentService = self::getContentService(); +// $repository = $this->getRepository(); +// $contentService = $repository->getContentService(); + + //$draft = $contentService->loadContent($draft->id, $languages, $draft->versionInfo->getVersionNo()); + var_dump("my content service", get_class($contentService)); + var_dump("vupdateStruct1", $updateStruct); + + // At this point, $updateStruct is correct. However, when it reaches Ibexa\Core\Persistence\Legacy\Content::updateFields(), + // it will have an additional field (in ger-DE). This does not happen when running the same code in + // a controller inside the application (you then need to replace 'self::get*Service()' with DI). + // It seems like for instance decoration Ibexa\Core\Event\ContentService is not used inside tests, maybe other decorations to? + $updatedDraft = $contentService->updateContent($draft->versionInfo,$updateStruct); + return $updatedDraft; + } + + +} \ No newline at end of file From 8610feada874de8934e44925d54b0467c151eb33 Mon Sep 17 00:00:00 2001 From: Vidar Langseid Date: Thu, 15 May 2025 11:07:07 +0200 Subject: [PATCH 3/6] fixup! IBX-9446: [BO] Fatal error after non-translatable field added to Content Type - Cleaned up test --- .../Persistence/Legacy/FileHandlerTest.php | 80 ------------------- 1 file changed, 80 deletions(-) diff --git a/tests/integration/Core/Persistence/Legacy/FileHandlerTest.php b/tests/integration/Core/Persistence/Legacy/FileHandlerTest.php index 2c416027f9..b13aff27b5 100644 --- a/tests/integration/Core/Persistence/Legacy/FileHandlerTest.php +++ b/tests/integration/Core/Persistence/Legacy/FileHandlerTest.php @@ -8,41 +8,20 @@ namespace Ibexa\Tests\Integration\Core\Persistence\Legacy; -use Ibexa\Contracts\Core\Repository\ContentTypeService; -use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\ContentUpdateStruct; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeCreateStruct; use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionCreateStruct; -use Ibexa\Tests\Integration\Core\FieldType\FieldConstraintsStorage\Stub\ExampleFieldType; -use Ibexa\Tests\Integration\Core\Repository\BaseTest; -use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Tests\Integration\Core\RepositoryTestCase; -//class FileHandlerTest extends BaseTest class FileHandlerTest extends RepositoryTestCase { - /* - export DATABASE_URL=mysql://test:test@db:3306/test ; export DATABASE=mysql://test:test@db:3306/test - time vendor/bin/phpunit -c phpunit-integration-legacy.xml --filter FileHandlerTest - - Ibexa\Core\Event\ContentService - */ - public function testUpdateFields(): void { $contentService = self::getContentService(); $contentTypeService = self::getContentTypeService(); - $permissionResolver = self::getPermissionResolver(); -// $repository = $this->getRepository(); -// $contentTypeService = $repository->getContentTypeService(); -// $contentService = $repository->getContentService(); -// $permissionResolver = $repository->getPermissionResolver(); - - // Create new ContentType - var_dump("SSSSSSSSSSSSSSSSTTTTTTTTTAAAAAAAAAARRRRRRRRRRRTTTTTTTTTTTTTTT"); $fieldDefCreateStruct = $this->createFieldDefinitionStruct('name', 'Name', true); $contentTypeCreateStruct = $this->createTypeCreateStruct(); @@ -63,13 +42,6 @@ public function testUpdateFields(): void $engUpdateStruct = $this->createUpdateStruct($content, '', ['eng-GB']); $engDraft = $this->createContentDraft($content, 'eng-GB'); $engDraft = $this->updateContent($engDraft, $engUpdateStruct); -// $content = $contentService->loadContent($content->getId(), ['ger-DE']); -// $gerUpdateStruct = $this->createUpdateStruct($content, '', ['ger-DE']); -// $gerDraft = $this->createContentDraft($content, 'ger-DE');; -// $gerDraft = $this->updateContent($gerDraft, $gerUpdateStruct); - -// $gerContent = $this->createDraft($content->getId(), '', ['ger-DE']); -// $gerContent = $this->createDraft($content->getId(), '', ['ger-DE']); // Create new non-translatable field @@ -81,28 +53,14 @@ public function testUpdateFields(): void $contentTypeService->publishContentTypeDraft($contentTypeDraft); // Update eng-GB draft - var_dump("PPPPPUUUBBBBBLISH", get_class($engUpdateStruct)); - // Ibexa\Core\Event\ContentService vs Ibexa\Core\Repository\SiteAccessAware\ContentService $engUpdateStruct->setField('non_trans_field', '', 'eng-GB'); $this->updateContent($engDraft, $engUpdateStruct); - //$contentService->updateContent($engContent->getVersionInfo(), $contentService->newContentUpdateStruct()); - //$contentService->publishVersion($engContent->versionInfo); - - - //$creatorId = $this->generateId('user', $permissionResolver->getCurrentUserReference()->getUserId()); - - - - var_dump("kake"); } private function createFieldDefinitionStruct(string $identifier, string $name, bool $isTranslatable): FieldDefinitionCreateStruct { $contentTypeService = self::getContentTypeService(); -// $repository = $this->getRepository(); -// $contentTypeService = $repository->getContentTypeService(); - $fieldDefCreateStruct = $contentTypeService->newFieldDefinitionCreateStruct( $identifier, 'ezstring' @@ -119,19 +77,9 @@ private function createFieldDefinitionStruct(string $identifier, string $name, b private function createTypeCreateStruct(): ContentTypeCreateStruct { $contentTypeService = self::getContentTypeService(); - $permissionResolver = self::getPermissionResolver(); - -// $repository = $this->getRepository(); -// $contentTypeService = $repository->getContentTypeService(); -// $permissionResolver = $repository->getPermissionResolver(); - - //$creatorId = $this->generateId('user', $permissionResolver->getCurrentUserReference()->getUserId()); - $typeCreateStruct = $contentTypeService->newContentTypeCreateStruct('multi_lang_drafts'); $typeCreateStruct->mainLanguageCode = 'eng-GB'; $typeCreateStruct->names = ['eng-GB' => 'Multi lang drafts']; - //$typeCreateStruct->creatorId = $creatorId; - //$typeCreateStruct->creationDate = $this->createDateTime(); return $typeCreateStruct; } @@ -141,10 +89,6 @@ protected function createNewContent(string $name, array $languages = ['eng-GB'], $contentTypeService = self::getContentTypeService(); $contentService = self::getContentService(); $locationService = self::getLocationService(); -// $repository = $this->getRepository(); -// $contentTypeService = $repository->getContentTypeService(); -// $contentService = $repository->getContentService(); -// $locationService = $repository->getLocationService(); $contentType = $contentTypeService->loadContentTypeByIdentifier('multi_lang_drafts'); $createStruct = $contentService->newContentCreateStruct($contentType, $languages[0]); @@ -162,10 +106,6 @@ protected function createNewContent(string $name, array $languages = ['eng-GB'], protected function createUpdateStruct(Content $content, string $translatedName, array $languages ) { $contentService = self::getContentService(); -// $repository = $this->getRepository(); -// $contentService = $repository->getContentService(); - - //$content = $contentService->loadContent($contentId); $updateStruct = $contentService->newContentUpdateStruct(); $updateStruct->initialLanguageCode = $languages[0]; @@ -176,30 +116,18 @@ protected function createUpdateStruct(Content $content, string $translatedName, $translatedNameOrg = $translatedName; } - /** Need to use $languiage param? */ - //$draft = $contentService->createContentDraft($content->contentInfo); foreach ($languages as $language) { $translatedName = "[$language]" . $translatedNameOrg; - //$updateStruct->initialLanguageCode = $newLanguage; $updateStruct->setField('name', $translatedName, $language); } return $updateStruct; -// $updatedContent = $contentService->updateContent($draft->versionInfo,$updateStruct); -// -// return $updatedContent; - //return $contentService->publishVersion($updatedContent->versionInfo); -// $this->output->writeln("Translated content: '$translatedName' with contentId=" . $content->getId() . ' and locationId=' . $content->contentInfo->mainLocationId . ' to language(s) : ' . implode(', ', $languages)); - } protected function createContentDraft(Content $content, string $languageCode): Content { $contentService = self::getContentService(); $contentLanguageService = self::getLanguageService(); -// $repository = $this->getRepository(); -// $contentService = $repository->getContentService(); -// $contentLanguageService = $repository->getContentLanguageService(); $language = $contentLanguageService->loadLanguage($languageCode); $draft = $contentService->createContentDraft($content->contentInfo, null, null, $language); @@ -209,12 +137,6 @@ protected function createContentDraft(Content $content, string $languageCode): C protected function updateContent(Content $draft, ContentUpdateStruct $updateStruct/*, array $languages*/): Content { $contentService = self::getContentService(); -// $repository = $this->getRepository(); -// $contentService = $repository->getContentService(); - - //$draft = $contentService->loadContent($draft->id, $languages, $draft->versionInfo->getVersionNo()); - var_dump("my content service", get_class($contentService)); - var_dump("vupdateStruct1", $updateStruct); // At this point, $updateStruct is correct. However, when it reaches Ibexa\Core\Persistence\Legacy\Content::updateFields(), // it will have an additional field (in ger-DE). This does not happen when running the same code in @@ -223,6 +145,4 @@ protected function updateContent(Content $draft, ContentUpdateStruct $updateStru $updatedDraft = $contentService->updateContent($draft->versionInfo,$updateStruct); return $updatedDraft; } - - } \ No newline at end of file From 7f355fb342460dfd82b799d49f113c17f56a09fe Mon Sep 17 00:00:00 2001 From: Vidar Langseid Date: Thu, 15 May 2025 11:17:56 +0200 Subject: [PATCH 4/6] fixup! fixup! IBX-9446: [BO] Fatal error after non-translatable field added to Content Type - Added testcase --- .../Core/Persistence/Legacy/FileHandlerTest.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/integration/Core/Persistence/Legacy/FileHandlerTest.php b/tests/integration/Core/Persistence/Legacy/FileHandlerTest.php index b13aff27b5..421052c590 100644 --- a/tests/integration/Core/Persistence/Legacy/FileHandlerTest.php +++ b/tests/integration/Core/Persistence/Legacy/FileHandlerTest.php @@ -18,7 +18,7 @@ class FileHandlerTest extends RepositoryTestCase { public function testUpdateFields(): void { - $contentService = self::getContentService(); + $contentService = self::getContentService(); $contentTypeService = self::getContentTypeService(); // Create new ContentType @@ -75,7 +75,8 @@ private function createFieldDefinitionStruct(string $identifier, string $name, b return $fieldDefCreateStruct; } - private function createTypeCreateStruct(): ContentTypeCreateStruct { + private function createTypeCreateStruct(): ContentTypeCreateStruct + { $contentTypeService = self::getContentTypeService(); $typeCreateStruct = $contentTypeService->newContentTypeCreateStruct('multi_lang_drafts'); $typeCreateStruct->mainLanguageCode = 'eng-GB'; @@ -84,7 +85,7 @@ private function createTypeCreateStruct(): ContentTypeCreateStruct { return $typeCreateStruct; } - protected function createNewContent(string $name, array $languages = ['eng-GB'], int $parentLocationId = 2, ): Content + protected function createNewContent(string $name, array $languages = ['eng-GB'], int $parentLocationId = 2): Content { $contentTypeService = self::getContentTypeService(); $contentService = self::getContentService(); @@ -103,7 +104,7 @@ protected function createNewContent(string $name, array $languages = ['eng-GB'], return $contentService->publishVersion($draft->versionInfo); } - protected function createUpdateStruct(Content $content, string $translatedName, array $languages ) + protected function createUpdateStruct(Content $content, string $translatedName, array $languages) { $contentService = self::getContentService(); @@ -121,6 +122,7 @@ protected function createUpdateStruct(Content $content, string $translatedName, $updateStruct->setField('name', $translatedName, $language); } + return $updateStruct; } @@ -131,6 +133,7 @@ protected function createContentDraft(Content $content, string $languageCode): C $language = $contentLanguageService->loadLanguage($languageCode); $draft = $contentService->createContentDraft($content->contentInfo, null, null, $language); + return $draft; } @@ -142,7 +145,8 @@ protected function updateContent(Content $draft, ContentUpdateStruct $updateStru // it will have an additional field (in ger-DE). This does not happen when running the same code in // a controller inside the application (you then need to replace 'self::get*Service()' with DI). // It seems like for instance decoration Ibexa\Core\Event\ContentService is not used inside tests, maybe other decorations to? - $updatedDraft = $contentService->updateContent($draft->versionInfo,$updateStruct); + $updatedDraft = $contentService->updateContent($draft->versionInfo, $updateStruct); + return $updatedDraft; } -} \ No newline at end of file +} From 94091aaa73c259041230929ed23d8e22dbc8e3e9 Mon Sep 17 00:00:00 2001 From: Vidar Langseid Date: Thu, 15 May 2025 11:18:15 +0200 Subject: [PATCH 5/6] fixup! fixup! IBX-9446: [BO] Fatal error after non-translatable field added to Content Type - Cleaned up test --- tests/integration/Core/Persistence/Legacy/FileHandlerTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/integration/Core/Persistence/Legacy/FileHandlerTest.php b/tests/integration/Core/Persistence/Legacy/FileHandlerTest.php index 421052c590..802eb5eb66 100644 --- a/tests/integration/Core/Persistence/Legacy/FileHandlerTest.php +++ b/tests/integration/Core/Persistence/Legacy/FileHandlerTest.php @@ -33,7 +33,6 @@ public function testUpdateFields(): void $contentTypeService->publishContentTypeDraft($contentType); - // Create content, with two translations $content = $this->createNewContent('Some Content', ['eng-GB', 'ger-DE']); @@ -43,7 +42,6 @@ public function testUpdateFields(): void $engDraft = $this->createContentDraft($content, 'eng-GB'); $engDraft = $this->updateContent($engDraft, $engUpdateStruct); - // Create new non-translatable field $contentType = $contentTypeService->loadContentTypeByIdentifier('multi_lang_drafts'); $contentTypeDraft = $contentTypeService->createContentTypeDraft($contentType); From 64969ce3987699e478f5b72b7e42c509ae4994c8 Mon Sep 17 00:00:00 2001 From: Vidar Langseid Date: Thu, 3 Jul 2025 11:55:22 +0200 Subject: [PATCH 6/6] Fixed PHPstan errors in tests --- .../Core/Persistence/Legacy/FileHandlerTest.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/integration/Core/Persistence/Legacy/FileHandlerTest.php b/tests/integration/Core/Persistence/Legacy/FileHandlerTest.php index 802eb5eb66..852ad36dba 100644 --- a/tests/integration/Core/Persistence/Legacy/FileHandlerTest.php +++ b/tests/integration/Core/Persistence/Legacy/FileHandlerTest.php @@ -83,6 +83,9 @@ private function createTypeCreateStruct(): ContentTypeCreateStruct return $typeCreateStruct; } + /** + * @param string[] $languages + */ protected function createNewContent(string $name, array $languages = ['eng-GB'], int $parentLocationId = 2): Content { $contentTypeService = self::getContentTypeService(); @@ -102,7 +105,10 @@ protected function createNewContent(string $name, array $languages = ['eng-GB'], return $contentService->publishVersion($draft->versionInfo); } - protected function createUpdateStruct(Content $content, string $translatedName, array $languages) + /** + * @param string[] $languages + */ + protected function createUpdateStruct(Content $content, string $translatedName, array $languages): ContentUpdateStruct { $contentService = self::getContentService();