Skip to content

Commit 081032f

Browse files
committed
IBX-6833: Applied review remarks
1 parent 1d54c9b commit 081032f

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

eZ/Publish/Core/Repository/ContentService.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1295,7 +1295,7 @@ protected function internalUpdateContent(
12951295
APIVersionInfo $versionInfo,
12961296
APIContentUpdateStruct $contentUpdateStruct,
12971297
?array $fieldIdentifiersToValidate = null,
1298-
bool $doAddEmpty = false
1298+
bool $copyEmptyField = false
12991299
): Content {
13001300
$contentUpdateStruct = clone $contentUpdateStruct;
13011301

@@ -1386,7 +1386,7 @@ protected function internalUpdateContent(
13861386
);
13871387
$fieldValues[$fieldDefinition->identifier][$languageCode] = $fieldValue;
13881388

1389-
if ($isRetained || $isCopied || ($isLanguageNew && $isEmpty && !$doAddEmpty) || $isProcessed) {
1389+
if ($isRetained || $isCopied || ($isLanguageNew && $isEmpty && !$copyEmptyField) || $isProcessed) {
13901390
continue;
13911391
}
13921392

tests/integration/Core/Repository/ContentService/CopyTranslationsFromPublishedVersionTest.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
use DateTime;
1212
use eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionCreateStruct;
13+
use eZ\Publish\Core\FieldType\TextLine;
1314
use eZ\Publish\Core\Repository\Values\Content\ContentUpdateStruct;
1415
use Ibexa\Tests\Integration\Core\RepositoryTestCase;
1516

@@ -67,11 +68,13 @@ public function testCopyTranslationsFromPublishedVersionCopiesEmptyValues(): voi
6768
$usContent = $contentService->updateContent($usDraft->getVersionInfo(), $contentUpdateStruct);
6869
$publishedUsContent = $contentService->publishVersion($usContent->getVersionInfo(), [self::US_LANGUAGE_CODE]);
6970

70-
$gerFieldValueInUsContent = $publishedUsContent->getField('title', self::GER_LANGUAGE_CODE)
71-
->getValue()
72-
->text;
71+
$usFieldValueInUsContent = $publishedUsContent->getField('title', self::US_LANGUAGE_CODE)->getValue();
72+
self::assertInstanceOf(TextLine\Value::class, $usFieldValueInUsContent);
73+
self::assertSame('', $usFieldValueInUsContent->text);
7374

74-
self::assertSame('', $gerFieldValueInUsContent);
75+
$gerFieldValueInUsContent = $publishedUsContent->getField('title', self::GER_LANGUAGE_CODE)->getValue();
76+
self::assertInstanceOf(TextLine\Value::class, $gerFieldValueInUsContent);
77+
self::assertSame('', $gerFieldValueInUsContent->text);
7578
}
7679

7780
private function createContentType(): void

0 commit comments

Comments
 (0)