Skip to content

Commit 8f9333e

Browse files
author
Pantea Marius-ciclistu
committed
keep primary_key_identifier type
1 parent 7329f38 commit 8f9333e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Http/Middleware/Decorators/AbstractDecoratorMiddleware.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,12 @@ protected function getListNewContent(Request $request, array $content, array $co
203203
foreach (($content['data'] ?? []) as $row) {
204204
$decoratedRow = $this->decorator->decorate((array)$row);
205205
$decoratedRow[AbstractResourceDecorator::PKI] ??= AbstractResourceDecorator::applyHtmlSpecialChars(
206-
\implode($this->resourceModel::COMPOSITE_PK_SEPARATOR, \array_map(
207-
fn(string $pk): string => $row[$pk] ?? '',
208-
$pks ??= $this->getPks()
209-
))
206+
($onePk ??= \count($pks ??= $this->getPks()) === 1) ?
207+
$row[$firstPk ??= \reset($pks)] :
208+
\implode(
209+
($this->relatedModel ?? $this->resourceModel)::COMPOSITE_PK_SEPARATOR,
210+
\array_map(fn(string $pk): mixed => $row[$pk] ?? '', $pks)
211+
)
210212
);
211213
$newContent['data'][] = $decoratedRow;
212214
}

0 commit comments

Comments
 (0)