Files
chill-bundles/src/Bundle/ChillPersonBundle/Audit/SubjectConverter/CommentSubjectConverter.php
2026-03-04 15:09:53 +01:00

49 lines
1.4 KiB
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\SubjectConverter;
use Chill\MainBundle\Audit\Subject;
use Chill\MainBundle\Audit\SubjectBag;
use Chill\MainBundle\Audit\SubjectConverterInterface;
use Chill\MainBundle\Audit\SubjectConverterManagerAwareInterface;
use Chill\MainBundle\Audit\SubjectConverterManagerAwareTrait;
use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
/**
* @implements SubjectConverterInterface<Comment>
*/
class CommentSubjectConverter implements SubjectConverterInterface, SubjectConverterManagerAwareInterface
{
use SubjectConverterManagerAwareTrait;
public function convert(mixed $subject, bool $includeAssociated = false): SubjectBag
{
$main = new SubjectBag(new Subject('accompanying_period_comment', ['id' => $subject->getId()]));
if (null !== $subject->getAccompanyingPeriod()) {
$main->append($this->subjectConverterManager->getSubjectsForEntity($subject->getAccompanyingPeriod(), false));
}
return $main;
}
public function supportsConvert(mixed $subject): bool
{
return $subject instanceof Comment;
}
public static function getDefaultPriority(): int
{
return 0;
}
}