mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-28 13:06:13 +00:00
Setup if condition in EntityToJsonTransformer.php for when 'me' is passed
This commit is contained in:
parent
b130dbdcdc
commit
9503cb89b6
@ -68,6 +68,17 @@ class EntityToJsonTransformer implements DataTransformerInterface
|
||||
|
||||
private function denormalizeOne(array|string $item)
|
||||
{
|
||||
if ('me' === $item) {
|
||||
dump($item);
|
||||
/* return
|
||||
$this->denormalizer->denormalize(
|
||||
// pass id of current user that we get from the exportGenerationContext...
|
||||
['type' => User::class, 'id' => $item['id']],
|
||||
User::class,
|
||||
'json',
|
||||
$context,
|
||||
);*/
|
||||
}
|
||||
if (!\array_key_exists('type', $item)) {
|
||||
throw new TransformationFailedException('the key "type" is missing on element');
|
||||
}
|
||||
@ -76,17 +87,6 @@ class EntityToJsonTransformer implements DataTransformerInterface
|
||||
throw new TransformationFailedException('the key "id" is missing on element');
|
||||
}
|
||||
|
||||
if ('me' === $item) {
|
||||
// return the denormalized current user
|
||||
/* return
|
||||
$this->denormalizer->denormalize(
|
||||
['type' => $item['type'], 'id' => $item['id']],
|
||||
User::class,
|
||||
'json',
|
||||
$context,
|
||||
);*/
|
||||
}
|
||||
|
||||
$class = match ($this->type) {
|
||||
'user' => User::class,
|
||||
'person' => Person::class,
|
||||
@ -109,5 +109,6 @@ class EntityToJsonTransformer implements DataTransformerInterface
|
||||
'json',
|
||||
$context,
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user