mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-22 18:24:23 +00:00
Normalize form data by converting entities using normalizeDoctrineEntity
and support array input in denormalizeStringRepresentation
.
This commit is contained in:
parent
92b71af239
commit
6b0c85cdf0
@ -111,9 +111,9 @@ class SocialWorkTypeFilter implements FilterInterface
|
|||||||
public function normalizeFormData(array $formData): array
|
public function normalizeFormData(array $formData): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'actionType' => $formData['actionType'],
|
'actionType' => $this->normalizeDoctrineEntity($formData['actionType']),
|
||||||
'goal' => $formData['goal'],
|
'goal' => $this->normalizeDoctrineEntity($formData['goal']),
|
||||||
'result' => $formData['result'],
|
'result' => $this->normalizeDoctrineEntity($formData['result']),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,8 +126,12 @@ class SocialWorkTypeFilter implements FilterInterface
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function denormalizeStringRepresentation(string $ids): array
|
private function denormalizeStringRepresentation(array|string $ids): array
|
||||||
{
|
{
|
||||||
|
if (is_array($ids)) {
|
||||||
|
return $ids;
|
||||||
|
}
|
||||||
|
|
||||||
return array_map(fn (string $id) => (int) $id, explode(',', $ids));
|
return array_map(fn (string $id) => (int) $id, explode(',', $ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user