WIP backend userOrMePicker

This commit is contained in:
Julie Lenaerts 2025-03-11 05:34:20 +01:00
parent ec5c4d51b3
commit b2b1865837
2 changed files with 13 additions and 2 deletions

View File

@ -66,7 +66,7 @@ class EntityToJsonTransformer implements DataTransformerInterface
]); ]);
} }
private function denormalizeOne(array $item) private function denormalizeOne(array|string $item)
{ {
if (!\array_key_exists('type', $item)) { if (!\array_key_exists('type', $item)) {
throw new TransformationFailedException('the key "type" is missing on element'); throw new TransformationFailedException('the key "type" is missing on element');
@ -76,6 +76,17 @@ class EntityToJsonTransformer implements DataTransformerInterface
throw new TransformationFailedException('the key "id" is missing on element'); 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) { $class = match ($this->type) {
'user' => User::class, 'user' => User::class,
'person' => Person::class, 'person' => Person::class,

View File

@ -68,7 +68,7 @@ class ReferrerFilter implements FilterInterface
{ {
$builder $builder
->add('accepted_referrers', PickUserOrMeDynamicType::class, [ ->add('accepted_referrers', PickUserOrMeDynamicType::class, [
'multiple' => true, 'multiple' => false,
]) ])
/* ->add('accepted_referrers', PickUserDynamicType::class, [ /* ->add('accepted_referrers', PickUserDynamicType::class, [
'multiple' => true, 'multiple' => true,