mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 05:44:24 +00:00
41 lines
1.0 KiB
PHP
41 lines
1.0 KiB
PHP
<?php
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Chill\PersonBundle\Serializer\Normalizer;
|
|
|
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin;
|
|
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
|
|
|
/**
|
|
* @internal we keep this normalizer, because the property 'text' may be replace by a rendering in the future
|
|
*/
|
|
final class AccompanyingPeriodOriginNormalizer implements NormalizerInterface
|
|
{
|
|
/**
|
|
* @param Origin $origin
|
|
* @param string|null $format
|
|
*/
|
|
public function normalize($origin, $format = null, array $context = [])
|
|
{
|
|
return [
|
|
'type' => 'origin',
|
|
'id' => $origin->getId(),
|
|
'label' => $origin->getLabel(),
|
|
'text' => $origin->getLabel(),
|
|
];
|
|
}
|
|
|
|
public function supportsNormalization($data, $format = null): bool
|
|
{
|
|
return $data instanceof Origin;
|
|
}
|
|
}
|