mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-27 09:05:01 +00:00
Add an api list of available person identifiers
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\PersonIdentifier\Normalizer;
|
||||
|
||||
use Chill\PersonBundle\PersonIdentifier\PersonIdentifierWorker;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
|
||||
final readonly class PersonIdentifierWorkerNormalizer implements NormalizerInterface
|
||||
{
|
||||
public function normalize($object, ?string $format = null, array $context = []): array
|
||||
{
|
||||
if (!$object instanceof PersonIdentifierWorker) {
|
||||
throw new \Symfony\Component\Serializer\Exception\UnexpectedValueException();
|
||||
}
|
||||
|
||||
return [
|
||||
'type' => 'person_identifier_worker',
|
||||
'id' => $object->getDefinition()->getId(),
|
||||
'engine' => $object->getDefinition()->getEngine(),
|
||||
'label' => $object->getDefinition()->getLabel(),
|
||||
'isActive' => $object->getDefinition()->isActive(),
|
||||
];
|
||||
}
|
||||
|
||||
public function supportsNormalization($data, ?string $format = null): bool
|
||||
{
|
||||
return $data instanceof PersonIdentifierWorker;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user