mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-30 19:43:49 +00:00
DX: apply rector rules up to php8.0
This commit is contained in:
@@ -20,16 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class ByCreatorAggregator implements AggregatorInterface
|
||||
{
|
||||
private UserRender $userRender;
|
||||
|
||||
private UserRepositoryInterface $userRepository;
|
||||
|
||||
public function __construct(
|
||||
UserRepositoryInterface $userRepository,
|
||||
UserRender $userRender
|
||||
) {
|
||||
$this->userRepository = $userRepository;
|
||||
$this->userRender = $userRender;
|
||||
public function __construct(private UserRepositoryInterface $userRepository, private UserRender $userRender)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
||||
|
||||
class BySocialActionAggregator implements AggregatorInterface
|
||||
{
|
||||
private SocialActionRender $actionRender;
|
||||
|
||||
private SocialActionRepository $actionRepository;
|
||||
|
||||
public function __construct(
|
||||
SocialActionRender $actionRender,
|
||||
SocialActionRepository $actionRepository
|
||||
) {
|
||||
$this->actionRender = $actionRender;
|
||||
$this->actionRepository = $actionRepository;
|
||||
public function __construct(private SocialActionRender $actionRender, private SocialActionRepository $actionRepository)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
||||
|
||||
class BySocialIssueAggregator implements AggregatorInterface
|
||||
{
|
||||
private SocialIssueRender $issueRender;
|
||||
|
||||
private SocialIssueRepository $issueRepository;
|
||||
|
||||
public function __construct(
|
||||
SocialIssueRepository $issueRepository,
|
||||
SocialIssueRender $issueRender
|
||||
) {
|
||||
$this->issueRepository = $issueRepository;
|
||||
$this->issueRender = $issueRender;
|
||||
public function __construct(private SocialIssueRepository $issueRepository, private SocialIssueRender $issueRender)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
||||
|
||||
class ByThirdpartyAggregator implements AggregatorInterface
|
||||
{
|
||||
private ThirdPartyRender $thirdPartyRender;
|
||||
|
||||
private ThirdPartyRepository $thirdPartyRepository;
|
||||
|
||||
public function __construct(
|
||||
ThirdPartyRepository $thirdPartyRepository,
|
||||
ThirdPartyRender $thirdPartyRender
|
||||
) {
|
||||
$this->thirdPartyRepository = $thirdPartyRepository;
|
||||
$this->thirdPartyRender = $thirdPartyRender;
|
||||
public function __construct(private ThirdPartyRepository $thirdPartyRepository, private ThirdPartyRender $thirdPartyRender)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
||||
|
||||
class CreatorScopeAggregator implements AggregatorInterface
|
||||
{
|
||||
private ScopeRepository $scopeRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
ScopeRepository $scopeRepository,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->scopeRepository = $scopeRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
public function __construct(private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -29,12 +29,8 @@ class DateAggregator implements AggregatorInterface
|
||||
|
||||
private const DEFAULT_CHOICE = 'year';
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
public function __construct(private TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
@@ -99,17 +95,9 @@ class DateAggregator implements AggregatorInterface
|
||||
return '';
|
||||
}
|
||||
|
||||
switch ($data['frequency']) {
|
||||
case 'month':
|
||||
case 'week':
|
||||
//return $this->translator->trans('for week') .' '. $value ;
|
||||
|
||||
case 'year':
|
||||
//return $this->translator->trans('in year') .' '. $value ;
|
||||
|
||||
default:
|
||||
return $value;
|
||||
}
|
||||
return match ($data['frequency']) {
|
||||
default => $value,
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
||||
|
||||
class LocationTypeAggregator implements AggregatorInterface
|
||||
{
|
||||
private LocationTypeRepository $locationTypeRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
LocationTypeRepository $locationTypeRepository,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->locationTypeRepository = $locationTypeRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
public function __construct(private LocationTypeRepository $locationTypeRepository, private TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -24,16 +24,8 @@ class ActivityTypeAggregator implements AggregatorInterface
|
||||
{
|
||||
public const KEY = 'activity_type_aggregator';
|
||||
|
||||
protected ActivityTypeRepositoryInterface $activityTypeRepository;
|
||||
|
||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
ActivityTypeRepositoryInterface $activityTypeRepository,
|
||||
TranslatableStringHelperInterface $translatableStringHelper
|
||||
) {
|
||||
$this->activityTypeRepository = $activityTypeRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
public function __construct(protected ActivityTypeRepositoryInterface $activityTypeRepository, protected TranslatableStringHelperInterface $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -23,16 +23,8 @@ class ActivityUserAggregator implements AggregatorInterface
|
||||
{
|
||||
public const KEY = 'activity_user_id';
|
||||
|
||||
private UserRender $userRender;
|
||||
|
||||
private UserRepository $userRepository;
|
||||
|
||||
public function __construct(
|
||||
UserRepository $userRepository,
|
||||
UserRender $userRender
|
||||
) {
|
||||
$this->userRepository = $userRepository;
|
||||
$this->userRender = $userRender;
|
||||
public function __construct(private UserRepository $userRepository, private UserRender $userRender)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -21,14 +21,8 @@ use function in_array;
|
||||
|
||||
class ActivityUsersAggregator implements AggregatorInterface
|
||||
{
|
||||
private UserRender $userRender;
|
||||
|
||||
private UserRepositoryInterface $userRepository;
|
||||
|
||||
public function __construct(UserRepositoryInterface $userRepository, UserRender $userRender)
|
||||
public function __construct(private UserRepositoryInterface $userRepository, private UserRender $userRender)
|
||||
{
|
||||
$this->userRepository = $userRepository;
|
||||
$this->userRender = $userRender;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -20,14 +20,8 @@ use function in_array;
|
||||
|
||||
class ActivityUsersJobAggregator implements \Chill\MainBundle\Export\AggregatorInterface
|
||||
{
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
private UserJobRepositoryInterface $userJobRepository;
|
||||
|
||||
public function __construct(UserJobRepositoryInterface $userJobRepository, TranslatableStringHelperInterface $translatableStringHelper)
|
||||
public function __construct(private UserJobRepositoryInterface $userJobRepository, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||
{
|
||||
$this->userJobRepository = $userJobRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -20,14 +20,8 @@ use function in_array;
|
||||
|
||||
class ActivityUsersScopeAggregator implements \Chill\MainBundle\Export\AggregatorInterface
|
||||
{
|
||||
private ScopeRepositoryInterface $scopeRepository;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
public function __construct(ScopeRepositoryInterface $scopeRepository, TranslatableStringHelperInterface $translatableStringHelper)
|
||||
public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||
{
|
||||
$this->scopeRepository = $scopeRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -30,20 +30,8 @@ use function in_array;
|
||||
|
||||
class ActivityReasonAggregator implements AggregatorInterface, ExportElementValidatedInterface
|
||||
{
|
||||
protected ActivityReasonCategoryRepository $activityReasonCategoryRepository;
|
||||
|
||||
protected ActivityReasonRepository $activityReasonRepository;
|
||||
|
||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
ActivityReasonCategoryRepository $activityReasonCategoryRepository,
|
||||
ActivityReasonRepository $activityReasonRepository,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->activityReasonCategoryRepository = $activityReasonCategoryRepository;
|
||||
$this->activityReasonRepository = $activityReasonRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
public function __construct(protected ActivityReasonCategoryRepository $activityReasonCategoryRepository, protected ActivityReasonRepository $activityReasonRepository, protected TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
@@ -113,21 +101,11 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
// for performance reason, we load data from db only once
|
||||
switch ($data['level']) {
|
||||
case 'reasons':
|
||||
$this->activityReasonRepository->findBy(['id' => $values]);
|
||||
|
||||
break;
|
||||
|
||||
case 'categories':
|
||||
$this->activityReasonCategoryRepository->findBy(['id' => $values]);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new RuntimeException(sprintf("The level data '%s' is invalid.", $data['level']));
|
||||
}
|
||||
match ($data['level']) {
|
||||
'reasons' => $this->activityReasonRepository->findBy(['id' => $values]),
|
||||
'categories' => $this->activityReasonCategoryRepository->findBy(['id' => $values]),
|
||||
default => throw new RuntimeException(sprintf("The level data '%s' is invalid.", $data['level'])),
|
||||
};
|
||||
|
||||
return function ($value) use ($data) {
|
||||
if ('_header' === $value) {
|
||||
|
@@ -20,11 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class SentReceivedAggregator implements AggregatorInterface
|
||||
{
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
public function __construct(private TranslatorInterface $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -24,20 +24,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class ListActivity implements ListInterface, GroupedExportInterface
|
||||
{
|
||||
private EntityManagerInterface $entityManager;
|
||||
|
||||
private ListActivityHelper $helper;
|
||||
|
||||
private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper;
|
||||
|
||||
public function __construct(
|
||||
ListActivityHelper $helper,
|
||||
EntityManagerInterface $entityManager,
|
||||
TranslatableStringExportLabelHelper $translatableStringExportLabelHelper
|
||||
) {
|
||||
$this->helper = $helper;
|
||||
$this->entityManager = $entityManager;
|
||||
$this->translatableStringExportLabelHelper = $translatableStringExportLabelHelper;
|
||||
public function __construct(private ListActivityHelper $helper, private EntityManagerInterface $entityManager, private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
@@ -62,22 +50,17 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
switch ($key) {
|
||||
case 'acpId':
|
||||
return static function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return ListActivityHelper::MSG_KEY . 'accompanying course id';
|
||||
}
|
||||
return match ($key) {
|
||||
'acpId' => static function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return ListActivityHelper::MSG_KEY . 'accompanying course id';
|
||||
}
|
||||
|
||||
return $value ?? '';
|
||||
};
|
||||
|
||||
case 'scopesNames':
|
||||
return $this->translatableStringExportLabelHelper->getLabelMulti($key, $values, ListActivityHelper::MSG_KEY . 'course circles');
|
||||
|
||||
default:
|
||||
return $this->helper->getLabels($key, $values, $data);
|
||||
}
|
||||
return $value ?? '';
|
||||
},
|
||||
'scopesNames' => $this->translatableStringExportLabelHelper->getLabelMulti($key, $values, ListActivityHelper::MSG_KEY . 'course circles'),
|
||||
default => $this->helper->getLabels($key, $values, $data),
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data)
|
||||
|
@@ -24,12 +24,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class CountActivity implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
protected ActivityRepository $activityRepository;
|
||||
|
||||
public function __construct(
|
||||
ActivityRepository $activityRepository
|
||||
) {
|
||||
$this->activityRepository = $activityRepository;
|
||||
public function __construct(protected ActivityRepository $activityRepository)
|
||||
{
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
|
@@ -36,8 +36,6 @@ use function in_array;
|
||||
|
||||
class ListActivity implements ListInterface, GroupedExportInterface
|
||||
{
|
||||
protected EntityManagerInterface $entityManager;
|
||||
|
||||
protected array $fields = [
|
||||
'id',
|
||||
'date',
|
||||
@@ -52,22 +50,8 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
'person_id',
|
||||
];
|
||||
|
||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
protected TranslatorInterface $translator;
|
||||
|
||||
private ActivityRepository $activityRepository;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
TranslatorInterface $translator,
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
ActivityRepository $activityRepository
|
||||
) {
|
||||
$this->entityManager = $em;
|
||||
$this->translator = $translator;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->activityRepository = $activityRepository;
|
||||
public function __construct(protected EntityManagerInterface $entityManager, protected TranslatorInterface $translator, protected TranslatableStringHelperInterface $translatableStringHelper, private ActivityRepository $activityRepository)
|
||||
{
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
|
@@ -32,22 +32,16 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
public const SUM = 'sum';
|
||||
|
||||
/**
|
||||
* The action for this report.
|
||||
*/
|
||||
protected string $action;
|
||||
|
||||
private ActivityRepository $activityRepository;
|
||||
|
||||
/**
|
||||
* @param string $action the stat to perform
|
||||
*/
|
||||
public function __construct(
|
||||
ActivityRepository $activityRepository,
|
||||
string $action = 'sum'
|
||||
private ActivityRepository $activityRepository,
|
||||
/**
|
||||
* The action for this report.
|
||||
*/
|
||||
protected string $action = 'sum'
|
||||
) {
|
||||
$this->action = $action;
|
||||
$this->activityRepository = $activityRepository;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
|
@@ -32,44 +32,8 @@ class ListActivityHelper
|
||||
{
|
||||
public const MSG_KEY = 'export.list.activity.';
|
||||
|
||||
private ActivityPresenceRepositoryInterface $activityPresenceRepository;
|
||||
|
||||
private ActivityTypeRepositoryInterface $activityTypeRepository;
|
||||
|
||||
private DateTimeHelper $dateTimeHelper;
|
||||
|
||||
private LabelPersonHelper $labelPersonHelper;
|
||||
|
||||
private LabelThirdPartyHelper $labelThirdPartyHelper;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
private TranslatableStringExportLabelHelper $translatableStringLabelHelper;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
private UserHelper $userHelper;
|
||||
|
||||
public function __construct(
|
||||
ActivityPresenceRepositoryInterface $activityPresenceRepository,
|
||||
ActivityTypeRepositoryInterface $activityTypeRepository,
|
||||
DateTimeHelper $dateTimeHelper,
|
||||
LabelPersonHelper $labelPersonHelper,
|
||||
LabelThirdPartyHelper $labelThirdPartyHelper,
|
||||
TranslatorInterface $translator,
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
TranslatableStringExportLabelHelper $translatableStringLabelHelper,
|
||||
UserHelper $userHelper
|
||||
) {
|
||||
$this->activityPresenceRepository = $activityPresenceRepository;
|
||||
$this->activityTypeRepository = $activityTypeRepository;
|
||||
$this->dateTimeHelper = $dateTimeHelper;
|
||||
$this->labelPersonHelper = $labelPersonHelper;
|
||||
$this->labelThirdPartyHelper = $labelThirdPartyHelper;
|
||||
$this->translator = $translator;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->translatableStringLabelHelper = $translatableStringLabelHelper;
|
||||
$this->userHelper = $userHelper;
|
||||
public function __construct(private ActivityPresenceRepositoryInterface $activityPresenceRepository, private ActivityTypeRepositoryInterface $activityTypeRepository, private DateTimeHelper $dateTimeHelper, private LabelPersonHelper $labelPersonHelper, private LabelThirdPartyHelper $labelThirdPartyHelper, private TranslatorInterface $translator, private TranslatableStringHelperInterface $translatableStringHelper, private TranslatableStringExportLabelHelper $translatableStringLabelHelper, private UserHelper $userHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function addSelect(QueryBuilder $qb): void
|
||||
@@ -115,113 +79,79 @@ class ListActivityHelper
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
switch ($key) {
|
||||
case 'createdAt':
|
||||
case 'updatedAt':
|
||||
return $this->dateTimeHelper->getLabel($key);
|
||||
return match ($key) {
|
||||
'createdAt', 'updatedAt' => $this->dateTimeHelper->getLabel($key),
|
||||
'createdBy', 'updatedBy' => $this->userHelper->getLabel($key, $values, $key),
|
||||
'date' => $this->dateTimeHelper->getLabel(self::MSG_KEY . $key),
|
||||
'attendeeName' => function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return 'Attendee';
|
||||
}
|
||||
|
||||
case 'createdBy':
|
||||
case 'updatedBy':
|
||||
return $this->userHelper->getLabel($key, $values, $key);
|
||||
if (null === $value || null === $presence = $this->activityPresenceRepository->find($value)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
case 'date':
|
||||
return $this->dateTimeHelper->getLabel(self::MSG_KEY . $key);
|
||||
return $this->translatableStringHelper->localize($presence->getName());
|
||||
},
|
||||
'listReasons' => $this->translatableStringLabelHelper->getLabelMulti($key, $values, 'Activity Reasons'),
|
||||
'typeName' => function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return 'Activity type';
|
||||
}
|
||||
|
||||
case 'attendeeName':
|
||||
return function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return 'Attendee';
|
||||
}
|
||||
if (null === $value || null === $type = $this->activityTypeRepository->find($value)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (null === $value || null === $presence = $this->activityPresenceRepository->find($value)) {
|
||||
return '';
|
||||
}
|
||||
return $this->translatableStringHelper->localize($type->getName());
|
||||
},
|
||||
'usersNames' => $this->userHelper->getLabelMulti($key, $values, self::MSG_KEY . 'users name'),
|
||||
'usersIds', 'thirdPartiesIds', 'personsIds' => static function ($value) use ($key) {
|
||||
if ('_header' === $value) {
|
||||
return match ($key) {
|
||||
'usersIds' => self::MSG_KEY . 'users ids',
|
||||
'thirdPartiesIds' => self::MSG_KEY . 'third parties ids',
|
||||
'personsIds' => self::MSG_KEY . 'persons ids',
|
||||
default => throw new LogicException('key not supported'),
|
||||
};
|
||||
}
|
||||
|
||||
return $this->translatableStringHelper->localize($presence->getName());
|
||||
};
|
||||
$decoded = json_decode($value, null, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
case 'listReasons':
|
||||
return $this->translatableStringLabelHelper->getLabelMulti($key, $values, 'Activity Reasons');
|
||||
return implode(
|
||||
'|',
|
||||
array_unique(
|
||||
array_filter($decoded, static fn (?int $id) => null !== $id),
|
||||
SORT_NUMERIC
|
||||
)
|
||||
);
|
||||
},
|
||||
'personsNames' => $this->labelPersonHelper->getLabelMulti($key, $values, self::MSG_KEY . 'persons name'),
|
||||
'thirdPartiesNames' => $this->labelThirdPartyHelper->getLabelMulti($key, $values, self::MSG_KEY . 'thirds parties'),
|
||||
'sentReceived' => function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return self::MSG_KEY . 'sent received';
|
||||
}
|
||||
|
||||
case 'typeName':
|
||||
return function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return 'Activity type';
|
||||
}
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (null === $value || null === $type = $this->activityTypeRepository->find($value)) {
|
||||
return '';
|
||||
}
|
||||
return $this->translator->trans($value);
|
||||
},
|
||||
default => function ($value) use ($key) {
|
||||
if ('_header' === $value) {
|
||||
return self::MSG_KEY . $key;
|
||||
}
|
||||
|
||||
return $this->translatableStringHelper->localize($type->getName());
|
||||
};
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
case 'usersNames':
|
||||
return $this->userHelper->getLabelMulti($key, $values, self::MSG_KEY . 'users name');
|
||||
|
||||
case 'usersIds':
|
||||
case 'thirdPartiesIds':
|
||||
case 'personsIds':
|
||||
return static function ($value) use ($key) {
|
||||
if ('_header' === $value) {
|
||||
switch ($key) {
|
||||
case 'usersIds':
|
||||
return self::MSG_KEY . 'users ids';
|
||||
|
||||
case 'thirdPartiesIds':
|
||||
return self::MSG_KEY . 'third parties ids';
|
||||
|
||||
case 'personsIds':
|
||||
return self::MSG_KEY . 'persons ids';
|
||||
|
||||
default:
|
||||
throw new LogicException('key not supported');
|
||||
}
|
||||
}
|
||||
|
||||
$decoded = json_decode($value, null, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
return implode(
|
||||
'|',
|
||||
array_unique(
|
||||
array_filter($decoded, static fn (?int $id) => null !== $id),
|
||||
SORT_NUMERIC
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
case 'personsNames':
|
||||
return $this->labelPersonHelper->getLabelMulti($key, $values, self::MSG_KEY . 'persons name');
|
||||
|
||||
case 'thirdPartiesNames':
|
||||
return $this->labelThirdPartyHelper->getLabelMulti($key, $values, self::MSG_KEY . 'thirds parties');
|
||||
|
||||
case 'sentReceived':
|
||||
return function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return self::MSG_KEY . 'sent received';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->translator->trans($value);
|
||||
};
|
||||
|
||||
default:
|
||||
return function ($value) use ($key) {
|
||||
if ('_header' === $value) {
|
||||
return self::MSG_KEY . $key;
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->translator->trans($value);
|
||||
};
|
||||
}
|
||||
return $this->translator->trans($value);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data)
|
||||
|
@@ -23,16 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class ActivityTypeFilter implements FilterInterface
|
||||
{
|
||||
private ActivityTypeRepositoryInterface $activityTypeRepository;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
ActivityTypeRepositoryInterface $activityTypeRepository,
|
||||
TranslatableStringHelperInterface $translatableStringHelper
|
||||
) {
|
||||
$this->activityTypeRepository = $activityTypeRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
public function __construct(private ActivityTypeRepositoryInterface $activityTypeRepository, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -20,11 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class ByCreatorFilter implements FilterInterface
|
||||
{
|
||||
private UserRender $userRender;
|
||||
|
||||
public function __construct(UserRender $userRender)
|
||||
public function __construct(private UserRender $userRender)
|
||||
{
|
||||
$this->userRender = $userRender;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -22,11 +22,8 @@ use function in_array;
|
||||
|
||||
class BySocialActionFilter implements FilterInterface
|
||||
{
|
||||
private SocialActionRender $actionRender;
|
||||
|
||||
public function __construct(SocialActionRender $actionRender)
|
||||
public function __construct(private SocialActionRender $actionRender)
|
||||
{
|
||||
$this->actionRender = $actionRender;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -22,11 +22,8 @@ use function in_array;
|
||||
|
||||
class BySocialIssueFilter implements FilterInterface
|
||||
{
|
||||
private SocialIssueRender $issueRender;
|
||||
|
||||
public function __construct(SocialIssueRender $issueRender)
|
||||
public function __construct(private SocialIssueRender $issueRender)
|
||||
{
|
||||
$this->issueRender = $issueRender;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -28,11 +28,8 @@ class EmergencyFilter implements FilterInterface
|
||||
|
||||
private const DEFAULT_CHOICE = false;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
public function __construct(private TranslatorInterface $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -22,11 +22,8 @@ use function in_array;
|
||||
|
||||
class LocationTypeFilter implements FilterInterface
|
||||
{
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
||||
public function __construct(private TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -29,11 +29,8 @@ class SentReceivedFilter implements FilterInterface
|
||||
|
||||
private const DEFAULT_CHOICE = Activity::SENTRECEIVED_SENT;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
public function __construct(private TranslatorInterface $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -21,11 +21,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class UserFilter implements FilterInterface
|
||||
{
|
||||
private UserRender $userRender;
|
||||
|
||||
public function __construct(UserRender $userRender)
|
||||
public function __construct(private UserRender $userRender)
|
||||
{
|
||||
$this->userRender = $userRender;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -23,11 +23,8 @@ use function in_array;
|
||||
|
||||
class UserScopeFilter implements FilterInterface
|
||||
{
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
||||
public function __construct(private TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -27,16 +27,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class ActivityDateFilter implements FilterInterface
|
||||
{
|
||||
protected TranslatorInterface $translator;
|
||||
|
||||
private RollingDateConverterInterface $rollingDateConverter;
|
||||
|
||||
public function __construct(
|
||||
TranslatorInterface $translator,
|
||||
RollingDateConverterInterface $rollingDateConverter
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
$this->rollingDateConverter = $rollingDateConverter;
|
||||
public function __construct(protected TranslatorInterface $translator, private RollingDateConverterInterface $rollingDateConverter)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -26,16 +26,8 @@ use function count;
|
||||
|
||||
class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInterface
|
||||
{
|
||||
protected ActivityTypeRepositoryInterface $activityTypeRepository;
|
||||
|
||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
ActivityTypeRepositoryInterface $activityTypeRepository
|
||||
) {
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->activityTypeRepository = $activityTypeRepository;
|
||||
public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, protected ActivityTypeRepositoryInterface $activityTypeRepository)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -20,11 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class ActivityUsersFilter implements FilterInterface
|
||||
{
|
||||
private UserRender $userRender;
|
||||
|
||||
public function __construct(UserRender $userRender)
|
||||
public function __construct(private UserRender $userRender)
|
||||
{
|
||||
$this->userRender = $userRender;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -29,16 +29,8 @@ use function in_array;
|
||||
|
||||
class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInterface
|
||||
{
|
||||
protected ActivityReasonRepository $activityReasonRepository;
|
||||
|
||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
TranslatableStringHelper $helper,
|
||||
ActivityReasonRepository $activityReasonRepository
|
||||
) {
|
||||
$this->translatableStringHelper = $helper;
|
||||
$this->activityReasonRepository = $activityReasonRepository;
|
||||
public function __construct(protected TranslatableStringHelper $translatableStringHelper, protected ActivityReasonRepository $activityReasonRepository)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -37,20 +37,8 @@ use function count;
|
||||
|
||||
class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInterface, FilterInterface
|
||||
{
|
||||
protected ActivityReasonRepository $activityReasonRepository;
|
||||
|
||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
protected TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
TranslatableStringHelper $translatableStringHelper,
|
||||
ActivityReasonRepository $activityReasonRepository,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->activityReasonRepository = $activityReasonRepository;
|
||||
$this->translator = $translator;
|
||||
public function __construct(protected TranslatableStringHelper $translatableStringHelper, protected ActivityReasonRepository $activityReasonRepository, protected TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -22,11 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class UsersJobFilter implements FilterInterface
|
||||
{
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
public function __construct(TranslatableStringHelperInterface $translatableStringHelper)
|
||||
public function __construct(private TranslatableStringHelperInterface $translatableStringHelper)
|
||||
{
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -23,16 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class UsersScopeFilter implements FilterInterface
|
||||
{
|
||||
private ScopeRepositoryInterface $scopeRepository;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
ScopeRepositoryInterface $scopeRepository,
|
||||
TranslatableStringHelperInterface $translatableStringHelper
|
||||
) {
|
||||
$this->scopeRepository = $scopeRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
Reference in New Issue
Block a user