Files
chill-bundles/src/Bundle/ChillMainBundle/Audit/SubjectConverterInterface.php
Julien Fastré 32c5f21438 Refactor subject conversion handling and enhance audit logging
- Replaced `Subject|array` return types with `SubjectBag` in `SubjectConverterInterface` for more robust handling.
- Updated `getSubjectsForEntity` to include an optional `$includeAssociated` parameter for finer control over associated subject resolution.
- Refactored `AuditEvent` to differentiate `mainSubject` from associated subjects, improving clarity in audit logging.
- Introduced database schema changes to add `main_subject` and `subjects` columns in the `chill_main_audit_trail` table.
- Added `SubjectBag` class for grouped subject management and implemented deduplication logic.
- Updated all converters and test cases to use the new `SubjectBag` approach, ensuring compatibility.
- Improved event dispatching in controllers to utilize the updated `AuditEvent` structure and refined metadata handling.
2026-02-13 17:07:30 +01:00

37 lines
856 B
PHP

<?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\MainBundle\Audit;
/**
* @template T
*/
interface SubjectConverterInterface
{
/**
* @param T $subject
*/
public function convert(mixed $subject, bool $includeAssociated = false): SubjectBag;
/**
* Determines whether the given subject is supported for conversion.
*
* @param mixed $subject the subject to check for conversion support
*
* @return bool true if the subject can be converted, false otherwise
*
* @phpstan-assert-if-true T $subject
*/
public function supportsConvert(mixed $subject): bool;
public static function getDefaultPriority(): int;
}