mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-22 10:14:24 +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
|
||||
{
|
||||
return [
|
||||
'actionType' => $formData['actionType'],
|
||||
'goal' => $formData['goal'],
|
||||
'result' => $formData['result'],
|
||||
'actionType' => $this->normalizeDoctrineEntity($formData['actionType']),
|
||||
'goal' => $this->normalizeDoctrineEntity($formData['goal']),
|
||||
'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));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user