Add PersonSubjectConverter for handling Person subject conversion in audits

- Created `PersonSubjectConverter` class implementing `SubjectConverterInterface` to convert `Person` entities into `Subject` instances.
- Registered the `Audit` namespace in `services.yaml` to enable automatic service discovery.
This commit is contained in:
2026-01-28 16:19:45 +01:00
parent d6f9aa6b45
commit 1de7da709c
2 changed files with 40 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
<?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\Audit\SubjectConverter;
use Chill\MainBundle\Audit\Subject;
use Chill\MainBundle\Audit\SubjectConverterInterface;
use Chill\PersonBundle\Entity\Person;
/**
* @implements SubjectConverterInterface<Person>
*/
class PersonSubjectConverter implements SubjectConverterInterface
{
public function convert(mixed $subject): Subject|array
{
return new Subject('person', ['id' => $subject->getId()]);
}
public function supportsConvert(mixed $subject): bool
{
return $subject instanceof Person;
}
public static function getDefaultPriority(): int
{
return 100;
}
}

View File

@@ -108,3 +108,6 @@ services:
Chill\PersonBundle\PersonIdentifier\Rendering\:
resource: '../PersonIdentifier/Rendering'
Chill\PersonBundle\Audit\:
resource: '../Audit'