Skip to content

Commit

Permalink
IBX-6833: Applied review remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
barw4 authored and Bartłomiej Wajda committed Jun 19, 2024
1 parent 96c4ab7 commit 3d412b6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions eZ/Publish/Core/Repository/ContentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,7 @@ protected function internalUpdateContent(
APIVersionInfo $versionInfo,
APIContentUpdateStruct $contentUpdateStruct,
?array $fieldIdentifiersToValidate = null,
bool $doAddEmpty = false
bool $copyEmptyField = false
): Content {
$contentUpdateStruct = clone $contentUpdateStruct;

Expand Down Expand Up @@ -1386,7 +1386,7 @@ protected function internalUpdateContent(
);
$fieldValues[$fieldDefinition->identifier][$languageCode] = $fieldValue;

if ($isRetained || $isCopied || ($isLanguageNew && $isEmpty && !$doAddEmpty) || $isProcessed) {
if ($isRetained || $isCopied || ($isLanguageNew && $isEmpty && !$copyEmptyField) || $isProcessed) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use DateTime;
use eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionCreateStruct;
use eZ\Publish\Core\FieldType\TextLine;
use eZ\Publish\Core\Repository\Values\Content\ContentUpdateStruct;
use Ibexa\Tests\Integration\Core\RepositoryTestCase;

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

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

self::assertSame('', $gerFieldValueInUsContent);
$gerFieldValueInUsContent = $publishedUsContent->getField('title', self::GER_LANGUAGE_CODE)->getValue();
self::assertInstanceOf(TextLine\Value::class, $gerFieldValueInUsContent);
self::assertSame('', $gerFieldValueInUsContent->text);
}

private function createContentType(): void
Expand Down

0 comments on commit 3d412b6

Please sign in to comment.