mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-02-26 02:00:01 +00:00
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -108,3 +108,6 @@ services:
|
||||
|
||||
Chill\PersonBundle\PersonIdentifier\Rendering\:
|
||||
resource: '../PersonIdentifier/Rendering'
|
||||
|
||||
Chill\PersonBundle\Audit\:
|
||||
resource: '../Audit'
|
||||
|
||||
Reference in New Issue
Block a user