mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-25 16:14:59 +00:00
Add external identifiers for person, editable in edit form, with minimal features associated
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?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;
|
||||
|
||||
use Chill\PersonBundle\Entity\Identifier\PersonIdentifier;
|
||||
use Chill\PersonBundle\Entity\Identifier\PersonIdentifierDefinition;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
final readonly class PersonIdentifierWorker
|
||||
{
|
||||
public function __construct(
|
||||
private PersonIdentifierEngineInterface $identifierEngine,
|
||||
private PersonIdentifierDefinition $definition,
|
||||
) {}
|
||||
|
||||
public function getIdentifierEngine(): PersonIdentifierEngineInterface
|
||||
{
|
||||
return $this->identifierEngine;
|
||||
}
|
||||
|
||||
public function getDefinition(): PersonIdentifierDefinition
|
||||
{
|
||||
return $this->definition;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder): void
|
||||
{
|
||||
$this->identifierEngine->buildForm($builder, $this->definition);
|
||||
}
|
||||
|
||||
public function canonicalizeValue(array $value): ?string
|
||||
{
|
||||
return $this->identifierEngine->canonicalizeValue($value, $this->definition);
|
||||
}
|
||||
|
||||
public function renderAsString(?PersonIdentifier $identifier): string
|
||||
{
|
||||
return $this->identifierEngine->renderAsString($identifier, $this->definition);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user