Files
chill-bundles/src/Bundle/ChillPersonBundle/Audit/Displayer/CommentSubjectDisplayer.php
Julien Fastré 222d20734c Add audit functionality for Comment actions and integrate CommentSubjectConverter and CommentSubjectDisplayer
- Introduced `CommentSubjectConverter` and `CommentSubjectDisplayer` for audit conversion and display logic.
- Integrated `TriggerAuditInterface` into `AccompanyingCourseCommentController` and added audit triggers for create, view, update, delete, pin, unpin, and list actions with translatable descriptions.
- Added unit test `CommentSubjectConverterTest` to ensure proper behavior of the subject converter.
- Enhanced French translations (`messages.fr.yml`) with audit-related labels for comment actions.
2026-03-02 10:30:58 +01:00

34 lines
989 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\PersonBundle\Audit\Displayer;
use Chill\MainBundle\Audit\Subject;
use Chill\MainBundle\Audit\SubjectDisplayerInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
final readonly class CommentSubjectDisplayer implements SubjectDisplayerInterface
{
public function __construct(
private TranslatorInterface $translator,
) {}
public function supportsDisplay(Subject $subject, array $options = []): bool
{
return 'accompanying_period_comment' === $subject->type;
}
public function display(Subject $subject, string $format = 'html', array $options = []): string
{
return $this->translator->trans('audit.accompanying_period_comment.comment_number', ['{id}' => $subject->identifiers['id']]);
}
}