mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
DX: apply rector rules up to php8.0
This commit is contained in:
parent
d8870e906f
commit
dde3002100
@ -47,76 +47,14 @@ use function array_key_exists;
|
||||
|
||||
final class ActivityController extends AbstractController
|
||||
{
|
||||
private AccompanyingPeriodRepository $accompanyingPeriodRepository;
|
||||
|
||||
private ActivityACLAwareRepositoryInterface $activityACLAwareRepository;
|
||||
|
||||
private ActivityRepository $activityRepository;
|
||||
|
||||
private ActivityTypeCategoryRepository $activityTypeCategoryRepository;
|
||||
|
||||
private ActivityTypeRepositoryInterface $activityTypeRepository;
|
||||
|
||||
private CenterResolverManagerInterface $centerResolver;
|
||||
|
||||
private EntityManagerInterface $entityManager;
|
||||
|
||||
private EventDispatcherInterface $eventDispatcher;
|
||||
|
||||
private LocationRepository $locationRepository;
|
||||
|
||||
private LoggerInterface $logger;
|
||||
|
||||
private PersonRepository $personRepository;
|
||||
|
||||
private SerializerInterface $serializer;
|
||||
|
||||
private ThirdPartyRepository $thirdPartyRepository;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
private UserRepositoryInterface $userRepository;
|
||||
|
||||
public function __construct(
|
||||
ActivityACLAwareRepositoryInterface $activityACLAwareRepository,
|
||||
ActivityTypeRepositoryInterface $activityTypeRepository,
|
||||
ActivityTypeCategoryRepository $activityTypeCategoryRepository,
|
||||
PersonRepository $personRepository,
|
||||
ThirdPartyRepository $thirdPartyRepository,
|
||||
LocationRepository $locationRepository,
|
||||
ActivityRepository $activityRepository,
|
||||
AccompanyingPeriodRepository $accompanyingPeriodRepository,
|
||||
EntityManagerInterface $entityManager,
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
LoggerInterface $logger,
|
||||
SerializerInterface $serializer,
|
||||
UserRepositoryInterface $userRepository,
|
||||
CenterResolverManagerInterface $centerResolver,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->activityACLAwareRepository = $activityACLAwareRepository;
|
||||
$this->activityTypeRepository = $activityTypeRepository;
|
||||
$this->activityTypeCategoryRepository = $activityTypeCategoryRepository;
|
||||
$this->personRepository = $personRepository;
|
||||
$this->thirdPartyRepository = $thirdPartyRepository;
|
||||
$this->locationRepository = $locationRepository;
|
||||
$this->activityRepository = $activityRepository;
|
||||
$this->accompanyingPeriodRepository = $accompanyingPeriodRepository;
|
||||
$this->entityManager = $entityManager;
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->logger = $logger;
|
||||
$this->serializer = $serializer;
|
||||
$this->userRepository = $userRepository;
|
||||
$this->centerResolver = $centerResolver;
|
||||
$this->translator = $translator;
|
||||
public function __construct(private ActivityACLAwareRepositoryInterface $activityACLAwareRepository, private ActivityTypeRepositoryInterface $activityTypeRepository, private ActivityTypeCategoryRepository $activityTypeCategoryRepository, private PersonRepository $personRepository, private ThirdPartyRepository $thirdPartyRepository, private LocationRepository $locationRepository, private ActivityRepository $activityRepository, private AccompanyingPeriodRepository $accompanyingPeriodRepository, private EntityManagerInterface $entityManager, private EventDispatcherInterface $eventDispatcher, private LoggerInterface $logger, private SerializerInterface $serializer, private UserRepositoryInterface $userRepository, private CenterResolverManagerInterface $centerResolver, private TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a Activity entity.
|
||||
*
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function deleteAction(Request $request, $id)
|
||||
public function deleteAction(Request $request, mixed $id)
|
||||
{
|
||||
$view = null;
|
||||
|
||||
|
@ -47,10 +47,8 @@ class ActivityReasonCategoryController extends AbstractController
|
||||
|
||||
/**
|
||||
* Displays a form to edit an existing ActivityReasonCategory entity.
|
||||
*
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function editAction($id)
|
||||
public function editAction(mixed $id)
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
@ -98,10 +96,8 @@ class ActivityReasonCategoryController extends AbstractController
|
||||
|
||||
/**
|
||||
* Finds and displays a ActivityReasonCategory entity.
|
||||
*
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function showAction($id)
|
||||
public function showAction(mixed $id)
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
@ -118,10 +114,8 @@ class ActivityReasonCategoryController extends AbstractController
|
||||
|
||||
/**
|
||||
* Edits an existing ActivityReasonCategory entity.
|
||||
*
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function updateAction(Request $request, $id)
|
||||
public function updateAction(Request $request, mixed $id)
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
|
@ -24,11 +24,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
*/
|
||||
class ActivityReasonController extends AbstractController
|
||||
{
|
||||
private ActivityReasonRepository $activityReasonRepository;
|
||||
|
||||
public function __construct(ActivityReasonRepository $activityReasonRepository)
|
||||
public function __construct(private ActivityReasonRepository $activityReasonRepository)
|
||||
{
|
||||
$this->activityReasonRepository = $activityReasonRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -56,10 +53,8 @@ class ActivityReasonController extends AbstractController
|
||||
|
||||
/**
|
||||
* Displays a form to edit an existing ActivityReason entity.
|
||||
*
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function editAction($id)
|
||||
public function editAction(mixed $id)
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
@ -107,10 +102,8 @@ class ActivityReasonController extends AbstractController
|
||||
|
||||
/**
|
||||
* Finds and displays a ActivityReason entity.
|
||||
*
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function showAction($id)
|
||||
public function showAction(mixed $id)
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
@ -127,10 +120,8 @@ class ActivityReasonController extends AbstractController
|
||||
|
||||
/**
|
||||
* Edits an existing ActivityReason entity.
|
||||
*
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function updateAction(Request $request, $id)
|
||||
public function updateAction(Request $request, mixed $id)
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
|
@ -25,17 +25,14 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface
|
||||
{
|
||||
use \Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
||||
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
/**
|
||||
* @var \Faker\Generator
|
||||
*/
|
||||
private $faker;
|
||||
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
public function __construct(private EntityManagerInterface $em)
|
||||
{
|
||||
$this->faker = FakerFactory::create('fr_FR');
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
public function getOrder()
|
||||
|
@ -83,10 +83,8 @@ class ActivityReason
|
||||
* Get name.
|
||||
*
|
||||
* @param mixed|null $locale
|
||||
*
|
||||
* @return array | string
|
||||
*/
|
||||
public function getName($locale = null)
|
||||
public function getName($locale = null): array|string
|
||||
{
|
||||
if ($locale) {
|
||||
if (isset($this->name[$locale])) {
|
||||
|
@ -21,7 +21,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
* @ORM\Table(name="activityreasoncategory")
|
||||
* @ORM\HasLifecycleCallbacks
|
||||
*/
|
||||
class ActivityReasonCategory
|
||||
class ActivityReasonCategory implements \Stringable
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
@ -65,7 +65,7 @@ class ActivityReasonCategory
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return 'ActivityReasonCategory(' . $this->getName('x') . ')';
|
||||
}
|
||||
|
@ -275,10 +275,8 @@ class ActivityType
|
||||
|
||||
/**
|
||||
* @Assert\Callback
|
||||
*
|
||||
* @param mixed $payload
|
||||
*/
|
||||
public function checkSocialActionsVisibility(ExecutionContextInterface $context, $payload)
|
||||
public function checkSocialActionsVisibility(ExecutionContextInterface $context, mixed $payload)
|
||||
{
|
||||
if ($this->socialIssuesVisible !== $this->socialActionsVisible) {
|
||||
if (!(2 === $this->socialIssuesVisible && 1 === $this->socialActionsVisible)) {
|
||||
|
@ -22,14 +22,8 @@ use function in_array;
|
||||
|
||||
class ActivityEntityListener
|
||||
{
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
private AccompanyingPeriodWorkRepository $workRepository;
|
||||
|
||||
public function __construct(EntityManagerInterface $em, AccompanyingPeriodWorkRepository $workRepository)
|
||||
public function __construct(private EntityManagerInterface $em, private AccompanyingPeriodWorkRepository $workRepository)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->workRepository = $workRepository;
|
||||
}
|
||||
|
||||
public function persistActionToCourse(Activity $activity)
|
||||
|
@ -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
|
||||
|
@ -58,40 +58,22 @@ use function in_array;
|
||||
|
||||
class ActivityType extends AbstractType
|
||||
{
|
||||
protected AuthorizationHelper $authorizationHelper;
|
||||
|
||||
protected ObjectManager $om;
|
||||
|
||||
protected SocialActionRender $socialActionRender;
|
||||
|
||||
protected SocialIssueRender $socialIssueRender;
|
||||
|
||||
protected array $timeChoices;
|
||||
|
||||
protected TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
protected User $user;
|
||||
|
||||
public function __construct(
|
||||
TokenStorageInterface $tokenStorage,
|
||||
AuthorizationHelper $authorizationHelper,
|
||||
ObjectManager $om,
|
||||
TranslatableStringHelper $translatableStringHelper,
|
||||
array $timeChoices,
|
||||
SocialIssueRender $socialIssueRender,
|
||||
SocialActionRender $socialActionRender
|
||||
protected AuthorizationHelper $authorizationHelper,
|
||||
protected ObjectManager $om,
|
||||
protected TranslatableStringHelper $translatableStringHelper,
|
||||
protected array $timeChoices,
|
||||
protected SocialIssueRender $socialIssueRender,
|
||||
protected SocialActionRender $socialActionRender
|
||||
) {
|
||||
if (!$tokenStorage->getToken()->getUser() instanceof User) {
|
||||
throw new RuntimeException('you should have a valid user');
|
||||
}
|
||||
|
||||
$this->user = $tokenStorage->getToken()->getUser();
|
||||
$this->authorizationHelper = $authorizationHelper;
|
||||
$this->om = $om;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->timeChoices = $timeChoices;
|
||||
$this->socialIssueRender = $socialIssueRender;
|
||||
$this->socialActionRender = $socialActionRender;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
|
@ -25,11 +25,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class ActivityTypeType extends AbstractType
|
||||
{
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
||||
public function __construct(private TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
|
@ -24,20 +24,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
*/
|
||||
class PickActivityReasonType extends AbstractType
|
||||
{
|
||||
private ActivityReasonRepository $activityReasonRepository;
|
||||
|
||||
private ActivityReasonRender $reasonRender;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
ActivityReasonRepository $activityReasonRepository,
|
||||
ActivityReasonRender $reasonRender,
|
||||
TranslatableStringHelperInterface $translatableStringHelper
|
||||
) {
|
||||
$this->activityReasonRepository = $activityReasonRepository;
|
||||
$this->reasonRender = $reasonRender;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
public function __construct(private ActivityReasonRepository $activityReasonRepository, private ActivityReasonRender $reasonRender, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
|
@ -23,14 +23,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
*/
|
||||
class TranslatableActivityReasonCategoryType extends AbstractType
|
||||
{
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(TranslatableStringHelperInterface $translatableStringHelper, TranslatorInterface $translator)
|
||||
public function __construct(private TranslatableStringHelperInterface $translatableStringHelper, private TranslatorInterface $translator)
|
||||
{
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
|
@ -20,16 +20,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class TranslatableActivityType extends AbstractType
|
||||
{
|
||||
protected ActivityTypeRepositoryInterface $activityTypeRepository;
|
||||
|
||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
TranslatableStringHelperInterface $helper,
|
||||
ActivityTypeRepositoryInterface $activityTypeRepository
|
||||
) {
|
||||
$this->translatableStringHelper = $helper;
|
||||
$this->activityTypeRepository = $activityTypeRepository;
|
||||
public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, protected ActivityTypeRepositoryInterface $activityTypeRepository)
|
||||
{
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
|
@ -23,16 +23,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
*/
|
||||
class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
protected Security $security;
|
||||
|
||||
protected TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
Security $security,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->security = $security;
|
||||
$this->translator = $translator;
|
||||
public function __construct(protected Security $security, protected TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||
|
@ -20,11 +20,8 @@ use Symfony\Component\Security\Core\Security;
|
||||
*/
|
||||
final class AdminMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
private Security $security;
|
||||
|
||||
public function __construct(Security $security)
|
||||
public function __construct(private Security $security)
|
||||
{
|
||||
$this->security = $security;
|
||||
}
|
||||
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||
|
@ -23,22 +23,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
*/
|
||||
final class PersonMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
/**
|
||||
* @var AuthorizationCheckerInterface
|
||||
*/
|
||||
protected $authorizationChecker;
|
||||
|
||||
/**
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
|
||||
public function __construct(
|
||||
AuthorizationCheckerInterface $authorizationChecker,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
$this->authorizationChecker = $authorizationChecker;
|
||||
public function __construct(protected AuthorizationCheckerInterface $authorizationChecker, protected TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||
|
@ -18,11 +18,8 @@ use Chill\MainBundle\Notification\NotificationHandlerInterface;
|
||||
|
||||
final class ActivityNotificationHandler implements NotificationHandlerInterface
|
||||
{
|
||||
private ActivityRepository $activityRepository;
|
||||
|
||||
public function __construct(ActivityRepository $activityRepository)
|
||||
public function __construct(private ActivityRepository $activityRepository)
|
||||
{
|
||||
$this->activityRepository = $activityRepository;
|
||||
}
|
||||
|
||||
public function getTemplate(Notification $notification, array $options = []): string
|
||||
|
@ -35,32 +35,8 @@ use function in_array;
|
||||
|
||||
final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInterface
|
||||
{
|
||||
private AuthorizationHelper $authorizationHelper;
|
||||
|
||||
private CenterResolverDispatcherInterface $centerResolverDispatcher;
|
||||
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
private ActivityRepository $repository;
|
||||
|
||||
private Security $security;
|
||||
|
||||
private TokenStorageInterface $tokenStorage;
|
||||
|
||||
public function __construct(
|
||||
AuthorizationHelper $authorizationHelper,
|
||||
CenterResolverDispatcherInterface $centerResolverDispatcher,
|
||||
TokenStorageInterface $tokenStorage,
|
||||
ActivityRepository $repository,
|
||||
EntityManagerInterface $em,
|
||||
Security $security
|
||||
) {
|
||||
$this->authorizationHelper = $authorizationHelper;
|
||||
$this->centerResolverDispatcher = $centerResolverDispatcher;
|
||||
$this->tokenStorage = $tokenStorage;
|
||||
$this->repository = $repository;
|
||||
$this->em = $em;
|
||||
$this->security = $security;
|
||||
public function __construct(private AuthorizationHelper $authorizationHelper, private CenterResolverDispatcherInterface $centerResolverDispatcher, private TokenStorageInterface $tokenStorage, private ActivityRepository $repository, private EntityManagerInterface $em, private Security $security)
|
||||
{
|
||||
}
|
||||
|
||||
public function findByAccompanyingPeriod(AccompanyingPeriod $period, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array
|
||||
|
@ -23,15 +23,11 @@ use Symfony\Component\HttpFoundation\RequestStack;
|
||||
*/
|
||||
class ActivityReasonRepository extends ServiceEntityRepository
|
||||
{
|
||||
private RequestStack $requestStack;
|
||||
|
||||
public function __construct(
|
||||
ManagerRegistry $registry,
|
||||
RequestStack $requestStack
|
||||
private RequestStack $requestStack
|
||||
) {
|
||||
parent::__construct($registry, ActivityReason::class);
|
||||
|
||||
$this->requestStack = $requestStack;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,15 +74,12 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
|
||||
self::FULL,
|
||||
];
|
||||
|
||||
protected Security $security;
|
||||
|
||||
protected VoterHelperInterface $voterHelper;
|
||||
|
||||
public function __construct(
|
||||
Security $security,
|
||||
protected Security $security,
|
||||
VoterHelperFactoryInterface $voterHelperFactory
|
||||
) {
|
||||
$this->security = $security;
|
||||
$this->voterHelper = $voterHelperFactory->generate(self::class)
|
||||
->addCheckFor(Person::class, [self::SEE, self::CREATE])
|
||||
->addCheckFor(AccompanyingPeriod::class, [self::SEE, self::CREATE])
|
||||
|
@ -39,40 +39,8 @@ class ActivityContext implements
|
||||
DocGeneratorContextWithAdminFormInterface,
|
||||
DocGeneratorContextWithPublicFormInterface
|
||||
{
|
||||
private BaseContextData $baseContextData;
|
||||
|
||||
private DocumentCategoryRepository $documentCategoryRepository;
|
||||
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
private NormalizerInterface $normalizer;
|
||||
|
||||
private PersonRenderInterface $personRender;
|
||||
|
||||
private PersonRepository $personRepository;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
DocumentCategoryRepository $documentCategoryRepository,
|
||||
NormalizerInterface $normalizer,
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
EntityManagerInterface $em,
|
||||
PersonRenderInterface $personRender,
|
||||
PersonRepository $personRepository,
|
||||
TranslatorInterface $translator,
|
||||
BaseContextData $baseContextData
|
||||
) {
|
||||
$this->documentCategoryRepository = $documentCategoryRepository;
|
||||
$this->normalizer = $normalizer;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->em = $em;
|
||||
$this->personRender = $personRender;
|
||||
$this->personRepository = $personRepository;
|
||||
$this->translator = $translator;
|
||||
$this->baseContextData = $baseContextData;
|
||||
public function __construct(private DocumentCategoryRepository $documentCategoryRepository, private NormalizerInterface $normalizer, private TranslatableStringHelperInterface $translatableStringHelper, private EntityManagerInterface $em, private PersonRenderInterface $personRender, private PersonRepository $personRepository, private TranslatorInterface $translator, private BaseContextData $baseContextData)
|
||||
{
|
||||
}
|
||||
|
||||
public function adminFormReverseTransform(array $data): array
|
||||
|
@ -48,44 +48,8 @@ class ListActivitiesByAccompanyingPeriodContext implements
|
||||
DocGeneratorContextWithAdminFormInterface,
|
||||
DocGeneratorContextWithPublicFormInterface
|
||||
{
|
||||
private AccompanyingPeriodContext $accompanyingPeriodContext;
|
||||
|
||||
private ActivityACLAwareRepositoryInterface $activityACLAwareRepository;
|
||||
|
||||
private NormalizerInterface $normalizer;
|
||||
|
||||
private PersonRepository $personRepository;
|
||||
|
||||
private SocialActionRepository $socialActionRepository;
|
||||
|
||||
private SocialIssueRepository $socialIssueRepository;
|
||||
|
||||
private ThirdPartyRepository $thirdPartyRepository;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
private UserRepository $userRepository;
|
||||
|
||||
public function __construct(
|
||||
AccompanyingPeriodContext $accompanyingPeriodContext,
|
||||
ActivityACLAwareRepositoryInterface $activityACLAwareRepository,
|
||||
NormalizerInterface $normalizer,
|
||||
PersonRepository $personRepository,
|
||||
SocialActionRepository $socialActionRepository,
|
||||
SocialIssueRepository $socialIssueRepository,
|
||||
ThirdPartyRepository $thirdPartyRepository,
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
UserRepository $userRepository,
|
||||
) {
|
||||
$this->accompanyingPeriodContext = $accompanyingPeriodContext;
|
||||
$this->activityACLAwareRepository = $activityACLAwareRepository;
|
||||
$this->normalizer = $normalizer;
|
||||
$this->personRepository = $personRepository;
|
||||
$this->socialActionRepository = $socialActionRepository;
|
||||
$this->socialIssueRepository = $socialIssueRepository;
|
||||
$this->thirdPartyRepository = $thirdPartyRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->userRepository = $userRepository;
|
||||
public function __construct(private AccompanyingPeriodContext $accompanyingPeriodContext, private ActivityACLAwareRepositoryInterface $activityACLAwareRepository, private NormalizerInterface $normalizer, private PersonRepository $personRepository, private SocialActionRepository $socialActionRepository, private SocialIssueRepository $socialIssueRepository, private ThirdPartyRepository $thirdPartyRepository, private TranslatableStringHelperInterface $translatableStringHelper, private UserRepository $userRepository)
|
||||
{
|
||||
}
|
||||
|
||||
public function adminFormReverseTransform(array $data): array
|
||||
|
@ -76,10 +76,8 @@ final class ActivityControllerTest extends WebTestCase
|
||||
|
||||
/**
|
||||
* @dataProvider getSecuredPagesUnauthenticated
|
||||
*
|
||||
* @param mixed $url
|
||||
*/
|
||||
public function testAccessIsDeniedForUnauthenticated($url)
|
||||
public function testAccessIsDeniedForUnauthenticated(mixed $url)
|
||||
{
|
||||
$client = $this->createClient();
|
||||
|
||||
@ -262,11 +260,9 @@ final class ActivityControllerTest extends WebTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $username
|
||||
*
|
||||
* @return \Symfony\Component\BrowserKit\Client
|
||||
*/
|
||||
private function getAuthenticatedClient($username = 'center a_social')
|
||||
private function getAuthenticatedClient(mixed $username = 'center a_social')
|
||||
{
|
||||
return self::createClient([], [
|
||||
'PHP_AUTH_USER' => $username,
|
||||
|
@ -89,11 +89,9 @@ final class TranslatableActivityTypeTest extends KernelTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $active
|
||||
*
|
||||
* @return \Chill\ActivityBundle\Entity\ActivityType
|
||||
*/
|
||||
protected function getRandomType($active = true)
|
||||
protected function getRandomType(mixed $active = true)
|
||||
{
|
||||
$types = $this->container->get('doctrine.orm.entity_manager')
|
||||
->getRepository(ActivityType::class)
|
||||
|
@ -33,24 +33,14 @@ class TimelineActivityProvider implements TimelineProviderInterface
|
||||
{
|
||||
private const SUPPORTED_CONTEXTS = ['center', 'person'];
|
||||
|
||||
protected ActivityACLAwareRepository $aclAwareRepository;
|
||||
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected AuthorizationHelperInterface $helper;
|
||||
|
||||
protected UserInterface $user;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
AuthorizationHelperInterface $helper,
|
||||
protected EntityManagerInterface $em,
|
||||
protected AuthorizationHelperInterface $helper,
|
||||
TokenStorageInterface $storage,
|
||||
ActivityACLAwareRepository $aclAwareRepository
|
||||
protected ActivityACLAwareRepository $aclAwareRepository
|
||||
) {
|
||||
$this->em = $em;
|
||||
$this->helper = $helper;
|
||||
$this->aclAwareRepository = $aclAwareRepository;
|
||||
|
||||
if (!$storage->getToken()->getUser() instanceof User) {
|
||||
throw new RuntimeException('A user should be authenticated !');
|
||||
}
|
||||
|
@ -21,11 +21,8 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
final class AsideActivityController extends CRUDController
|
||||
{
|
||||
private AsideActivityCategoryRepository $categoryRepository;
|
||||
|
||||
public function __construct(AsideActivityCategoryRepository $categoryRepository)
|
||||
public function __construct(private AsideActivityCategoryRepository $categoryRepository)
|
||||
{
|
||||
$this->categoryRepository = $categoryRepository;
|
||||
}
|
||||
|
||||
public function createEntity(string $action, Request $request): object
|
||||
|
@ -24,11 +24,8 @@ use function random_int;
|
||||
|
||||
class LoadAsideActivity extends Fixture implements DependentFixtureInterface
|
||||
{
|
||||
private UserRepository $userRepository;
|
||||
|
||||
public function __construct(UserRepository $userRepository)
|
||||
public function __construct(private UserRepository $userRepository)
|
||||
{
|
||||
$this->userRepository = $userRepository;
|
||||
}
|
||||
|
||||
public function getDependencies(): array
|
||||
|
@ -114,10 +114,8 @@ class AsideActivityCategory
|
||||
|
||||
/**
|
||||
* @Assert\Callback
|
||||
*
|
||||
* @param mixed $payload
|
||||
*/
|
||||
public function preventRecursiveParent(ExecutionContextInterface $context, $payload)
|
||||
public function preventRecursiveParent(ExecutionContextInterface $context, mixed $payload)
|
||||
{
|
||||
if (!$this->hasParent()) {
|
||||
return;
|
||||
|
@ -20,14 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class ByActivityTypeAggregator implements AggregatorInterface
|
||||
{
|
||||
private AsideActivityCategoryRepository $asideActivityCategoryRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(AsideActivityCategoryRepository $asideActivityCategoryRepository, TranslatableStringHelper $translatableStringHelper)
|
||||
public function __construct(private AsideActivityCategoryRepository $asideActivityCategoryRepository, private TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
$this->asideActivityCategoryRepository = $asideActivityCategoryRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@ -22,14 +22,8 @@ use function in_array;
|
||||
|
||||
class ByUserJobAggregator implements 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
|
||||
|
@ -22,14 +22,8 @@ use function in_array;
|
||||
|
||||
class ByUserScopeAggregator implements 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
|
||||
|
@ -23,12 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class AvgAsideActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
private AsideActivityRepository $repository;
|
||||
|
||||
public function __construct(
|
||||
AsideActivityRepository $repository
|
||||
) {
|
||||
$this->repository = $repository;
|
||||
public function __construct(private AsideActivityRepository $repository)
|
||||
{
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
|
@ -23,12 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class CountAsideActivity implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
private AsideActivityRepository $repository;
|
||||
|
||||
public function __construct(
|
||||
AsideActivityRepository $repository
|
||||
) {
|
||||
$this->repository = $repository;
|
||||
public function __construct(private AsideActivityRepository $repository)
|
||||
{
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
|
@ -34,40 +34,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
||||
{
|
||||
private AsideActivityCategoryRepository $asideActivityCategoryRepository;
|
||||
|
||||
private CategoryRender $categoryRender;
|
||||
|
||||
private CenterRepositoryInterface $centerRepository;
|
||||
|
||||
private DateTimeHelper $dateTimeHelper;
|
||||
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
private ScopeRepositoryInterface $scopeRepository;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
private UserHelper $userHelper;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
DateTimeHelper $dateTimeHelper,
|
||||
UserHelper $userHelper,
|
||||
ScopeRepositoryInterface $scopeRepository,
|
||||
CenterRepositoryInterface $centerRepository,
|
||||
AsideActivityCategoryRepository $asideActivityCategoryRepository,
|
||||
CategoryRender $categoryRender,
|
||||
TranslatableStringHelperInterface $translatableStringHelper
|
||||
) {
|
||||
$this->em = $em;
|
||||
$this->dateTimeHelper = $dateTimeHelper;
|
||||
$this->userHelper = $userHelper;
|
||||
$this->scopeRepository = $scopeRepository;
|
||||
$this->centerRepository = $centerRepository;
|
||||
$this->asideActivityCategoryRepository = $asideActivityCategoryRepository;
|
||||
$this->categoryRender = $categoryRender;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
public function __construct(private EntityManagerInterface $em, private DateTimeHelper $dateTimeHelper, private UserHelper $userHelper, private ScopeRepositoryInterface $scopeRepository, private CenterRepositoryInterface $centerRepository, private AsideActivityCategoryRepository $asideActivityCategoryRepository, private CategoryRender $categoryRender, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
@ -91,86 +59,67 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
switch ($key) {
|
||||
case 'id':
|
||||
case 'note':
|
||||
return static function ($value) use ($key) {
|
||||
if ('_header' === $value) {
|
||||
return 'export.aside_activity.' . $key;
|
||||
}
|
||||
return match ($key) {
|
||||
'id', 'note' => static function ($value) use ($key) {
|
||||
if ('_header' === $value) {
|
||||
return 'export.aside_activity.' . $key;
|
||||
}
|
||||
|
||||
return $value ?? '';
|
||||
};
|
||||
return $value ?? '';
|
||||
},
|
||||
'duration' => static function ($value) use ($key) {
|
||||
if ('_header' === $value) {
|
||||
return 'export.aside_activity.' . $key;
|
||||
}
|
||||
|
||||
case 'duration':
|
||||
return static function ($value) use ($key) {
|
||||
if ('_header' === $value) {
|
||||
return 'export.aside_activity.' . $key;
|
||||
}
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
if ($value instanceof DateTimeInterface) {
|
||||
return $value->format('H:i:s');
|
||||
}
|
||||
|
||||
if ($value instanceof DateTimeInterface) {
|
||||
return $value->format('H:i:s');
|
||||
}
|
||||
return $value;
|
||||
},
|
||||
'createdAt', 'updatedAt', 'date' => $this->dateTimeHelper->getLabel('export.aside_activity.' . $key),
|
||||
'agent_id', 'creator_id' => $this->userHelper->getLabel($key, $values, 'export.aside_activity.' . $key),
|
||||
'aside_activity_type' => function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return 'export.aside_activity.aside_activity_type';
|
||||
}
|
||||
|
||||
return $value;
|
||||
};
|
||||
if (null === $value || '' === $value || null === $c = $this->asideActivityCategoryRepository->find($value)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
case 'createdAt':
|
||||
case 'updatedAt':
|
||||
case 'date':
|
||||
return $this->dateTimeHelper->getLabel('export.aside_activity.' . $key);
|
||||
return $this->categoryRender->renderString($c, []);
|
||||
},
|
||||
'main_scope' => function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return 'export.aside_activity.main_scope';
|
||||
}
|
||||
|
||||
case 'agent_id':
|
||||
case 'creator_id':
|
||||
return $this->userHelper->getLabel($key, $values, 'export.aside_activity.' . $key);
|
||||
if (null === $value || '' === $value || null === $c = $this->scopeRepository->find($value)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
case 'aside_activity_type':
|
||||
return function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return 'export.aside_activity.aside_activity_type';
|
||||
}
|
||||
return $this->translatableStringHelper->localize($c->getName());
|
||||
},
|
||||
'main_center' => function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return 'export.aside_activity.main_center';
|
||||
}
|
||||
|
||||
if (null === $value || '' === $value || null === $c = $this->asideActivityCategoryRepository->find($value)) {
|
||||
return '';
|
||||
}
|
||||
if (null === $value || '' === $value || null === $c = $this->centerRepository->find($value)) {
|
||||
/** @var Center $c */
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->categoryRender->renderString($c, []);
|
||||
};
|
||||
|
||||
case 'main_scope':
|
||||
return function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return 'export.aside_activity.main_scope';
|
||||
}
|
||||
|
||||
if (null === $value || '' === $value || null === $c = $this->scopeRepository->find($value)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->translatableStringHelper->localize($c->getName());
|
||||
};
|
||||
|
||||
case 'main_center':
|
||||
return function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return 'export.aside_activity.main_center';
|
||||
}
|
||||
|
||||
if (null === $value || '' === $value || null === $c = $this->centerRepository->find($value)) {
|
||||
/** @var Center $c */
|
||||
return '';
|
||||
}
|
||||
|
||||
return $c->getName();
|
||||
};
|
||||
|
||||
default:
|
||||
throw new LogicException('this key is not supported : ' . $key);
|
||||
}
|
||||
return $c->getName();
|
||||
},
|
||||
default => throw new LogicException('this key is not supported : ' . $key),
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data)
|
||||
|
@ -23,12 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class SumAsideActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
private AsideActivityRepository $repository;
|
||||
|
||||
public function __construct(
|
||||
AsideActivityRepository $repository
|
||||
) {
|
||||
$this->repository = $repository;
|
||||
public function __construct(private AsideActivityRepository $repository)
|
||||
{
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
|
@ -23,20 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class ByActivityTypeFilter implements FilterInterface
|
||||
{
|
||||
private AsideActivityCategoryRepository $asideActivityTypeRepository;
|
||||
|
||||
private CategoryRender $categoryRender;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
CategoryRender $categoryRender,
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
AsideActivityCategoryRepository $asideActivityTypeRepository
|
||||
) {
|
||||
$this->categoryRender = $categoryRender;
|
||||
$this->asideActivityTypeRepository = $asideActivityTypeRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
public function __construct(private CategoryRender $categoryRender, private TranslatableStringHelperInterface $translatableStringHelper, private AsideActivityCategoryRepository $asideActivityTypeRepository)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@ -26,16 +26,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class ByDateFilter implements FilterInterface
|
||||
{
|
||||
protected TranslatorInterface $translator;
|
||||
|
||||
private RollingDateConverterInterface $rollingDateConverter;
|
||||
|
||||
public function __construct(
|
||||
RollingDateConverterInterface $rollingDateConverter,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
$this->rollingDateConverter = $rollingDateConverter;
|
||||
public function __construct(private RollingDateConverterInterface $rollingDateConverter, protected TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@ -20,11 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class ByUserFilter 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 Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class ByUserJobFilter 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 ByUserScopeFilter 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
|
||||
|
@ -22,12 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
final class AsideActivityCategoryType extends AbstractType
|
||||
{
|
||||
private CategoryRender $categoryRender;
|
||||
|
||||
public function __construct(
|
||||
CategoryRender $categoryRender
|
||||
) {
|
||||
$this->categoryRender = $categoryRender;
|
||||
public function __construct(private CategoryRender $categoryRender)
|
||||
{
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
|
@ -20,12 +20,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
final class PickAsideActivityCategoryType extends AbstractType
|
||||
{
|
||||
private CategoryRender $categoryRender;
|
||||
|
||||
public function __construct(
|
||||
CategoryRender $categoryRender
|
||||
) {
|
||||
$this->categoryRender = $categoryRender;
|
||||
public function __construct(private CategoryRender $categoryRender)
|
||||
{
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
|
@ -16,11 +16,8 @@ use Symfony\Component\Security\Core\Security;
|
||||
|
||||
final class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface
|
||||
{
|
||||
private Security $security;
|
||||
|
||||
public function __construct(Security $security)
|
||||
public function __construct(private Security $security)
|
||||
{
|
||||
$this->security = $security;
|
||||
}
|
||||
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||
|
@ -21,14 +21,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
*/
|
||||
class SectionMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
public AuthorizationCheckerInterface $authorizationChecker;
|
||||
|
||||
protected TranslatorInterface $translator;
|
||||
|
||||
public function __construct(TranslatorInterface $translator, AuthorizationCheckerInterface $authorizationChecker)
|
||||
public function __construct(protected TranslatorInterface $translator, public AuthorizationCheckerInterface $authorizationChecker)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
$this->authorizationChecker = $authorizationChecker;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,14 +27,8 @@ final class CategoryRender implements ChillEntityRenderInterface
|
||||
|
||||
public const SEPERATOR_KEY = 'default.separator';
|
||||
|
||||
private EngineInterface $engine;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(TranslatableStringHelper $translatableStringHelper, EngineInterface $engine)
|
||||
public function __construct(private TranslatableStringHelper $translatableStringHelper, private EngineInterface $engine)
|
||||
{
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->engine = $engine;
|
||||
}
|
||||
|
||||
public function buildParents(AsideActivityCategory $asideActivityCategory)
|
||||
|
@ -27,20 +27,8 @@ use function get_class;
|
||||
|
||||
abstract class AbstractElementController extends AbstractController
|
||||
{
|
||||
protected LoggerInterface $chillMainLogger;
|
||||
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
TranslatorInterface $translator,
|
||||
LoggerInterface $chillMainLogger
|
||||
) {
|
||||
$this->em = $em;
|
||||
$this->translator = $translator;
|
||||
$this->chillMainLogger = $chillMainLogger;
|
||||
public function __construct(protected EntityManagerInterface $em, protected TranslatorInterface $translator, protected LoggerInterface $chillMainLogger)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
@ -48,11 +36,8 @@ abstract class AbstractElementController extends AbstractController
|
||||
* "{_locale}/family-members/family-members/{id}/delete",
|
||||
* name="chill_family_members_family_members_delete"
|
||||
* ).
|
||||
*
|
||||
* @param mixed $template
|
||||
* @param mixed $flashMessage
|
||||
*/
|
||||
protected function _delete(AbstractElement $element, Request $request, $template, $flashMessage): Response
|
||||
protected function _delete(AbstractElement $element, Request $request, mixed $template, mixed $flashMessage): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted(BudgetElementVoter::DELETE, $element, 'You are not '
|
||||
. 'allowed to delete this item');
|
||||
@ -72,7 +57,7 @@ abstract class AbstractElementController extends AbstractController
|
||||
|
||||
if ($form->isValid()) {
|
||||
$this->chillMainLogger->notice('A budget element has been removed', [
|
||||
'family_element' => get_class($element),
|
||||
'family_element' => $element::class,
|
||||
'by_user' => $this->getUser()->getUsername(),
|
||||
'family_member_id' => $element->getId(),
|
||||
'amount' => $element->getAmount(),
|
||||
@ -141,12 +126,7 @@ abstract class AbstractElementController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $template
|
||||
* @param mixed $flashMessageOnSuccess
|
||||
* @param mixed $entity
|
||||
*/
|
||||
protected function _new($entity, Request $request, $template, $flashMessageOnSuccess)
|
||||
protected function _new(mixed $entity, Request $request, mixed $template, mixed $flashMessageOnSuccess)
|
||||
{
|
||||
/** @var AbstractElement $element */
|
||||
$element = $this->createNewElement();
|
||||
@ -196,10 +176,8 @@ abstract class AbstractElementController extends AbstractController
|
||||
* "{_locale}/family-members/family-members/{id}/view",
|
||||
* name="chill_family_members_family_members_view"
|
||||
* ).
|
||||
*
|
||||
* @param mixed $template
|
||||
*/
|
||||
protected function _view(AbstractElement $element, $template)
|
||||
protected function _view(AbstractElement $element, mixed $template)
|
||||
{
|
||||
$this->denyAccessUnlessGranted(BudgetElementVoter::SEE, $element);
|
||||
|
||||
|
@ -31,20 +31,8 @@ use function count;
|
||||
|
||||
class ElementController extends AbstractController
|
||||
{
|
||||
private CalculatorManager $calculator;
|
||||
|
||||
private ResourceRepository $resourceRepository;
|
||||
|
||||
private ChargeRepository $chargeRepository;
|
||||
|
||||
public function __construct(
|
||||
CalculatorManager $calculator,
|
||||
ResourceRepository $resourceRepository,
|
||||
ChargeRepository $chargeRepository,
|
||||
) {
|
||||
$this->calculator = $calculator;
|
||||
$this->resourceRepository = $resourceRepository;
|
||||
$this->chargeRepository = $chargeRepository;
|
||||
public function __construct(private CalculatorManager $calculator, private ResourceRepository $resourceRepository, private ChargeRepository $chargeRepository)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,20 +27,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class ChargeType extends AbstractType
|
||||
{
|
||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
private ChargeKindRepository $repository;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
ChargeKindRepository $repository,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->repository = $repository;
|
||||
$this->translator = $translator;
|
||||
public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, private ChargeKindRepository $repository, private TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
|
@ -26,20 +26,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class ResourceType extends AbstractType
|
||||
{
|
||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
private ResourceKindRepository $repository;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
ResourceKindRepository $repository,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->repository = $repository;
|
||||
$this->translator = $translator;
|
||||
public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, private ResourceKindRepository $repository, private TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
|
@ -17,11 +17,8 @@ use Symfony\Component\Security\Core\Security;
|
||||
|
||||
final class AdminMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
private Security $security;
|
||||
|
||||
public function __construct(Security $security)
|
||||
public function __construct(private Security $security)
|
||||
{
|
||||
$this->security = $security;
|
||||
}
|
||||
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||
|
@ -20,16 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class HouseholdMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
protected AuthorizationCheckerInterface $authorizationChecker;
|
||||
|
||||
protected TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
AuthorizationCheckerInterface $authorizationChecker,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->authorizationChecker = $authorizationChecker;
|
||||
$this->translator = $translator;
|
||||
public function __construct(protected AuthorizationCheckerInterface $authorizationChecker, protected TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||
|
@ -20,16 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class PersonMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
protected AuthorizationCheckerInterface $authorizationChecker;
|
||||
|
||||
protected TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
AuthorizationCheckerInterface $authorizationChecker,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->authorizationChecker = $authorizationChecker;
|
||||
$this->translator = $translator;
|
||||
public function __construct(protected AuthorizationCheckerInterface $authorizationChecker, protected TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||
|
@ -37,24 +37,8 @@ final class SummaryBudget implements SummaryBudgetInterface
|
||||
|
||||
private const QUERY_RESOURCE_BY_PERSON = 'select SUM(amount) AS sum, string_agg(comment, \'|\') AS comment, resource_id AS kind_id FROM chill_budget.resource WHERE person_id = ? AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY resource_id';
|
||||
|
||||
private ChargeKindRepositoryInterface $chargeKindRepository;
|
||||
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
private ResourceKindRepositoryInterface $resourceKindRepository;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
ResourceKindRepositoryInterface $resourceKindRepository,
|
||||
ChargeKindRepositoryInterface $chargeKindRepository
|
||||
) {
|
||||
$this->em = $em;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->resourceKindRepository = $resourceKindRepository;
|
||||
$this->chargeKindRepository = $chargeKindRepository;
|
||||
public function __construct(private EntityManagerInterface $em, private TranslatableStringHelperInterface $translatableStringHelper, private ResourceKindRepositoryInterface $resourceKindRepository, private ChargeKindRepositoryInterface $chargeKindRepository)
|
||||
{
|
||||
}
|
||||
|
||||
public function getSummaryForHousehold(?Household $household): array
|
||||
|
@ -22,14 +22,8 @@ use Symfony\Component\Templating\EngineInterface;
|
||||
*/
|
||||
final class BudgetElementTypeRender implements ChillEntityRenderInterface
|
||||
{
|
||||
private EngineInterface $engine;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
public function __construct(TranslatableStringHelperInterface $translatableStringHelper, EngineInterface $engine)
|
||||
public function __construct(private TranslatableStringHelperInterface $translatableStringHelper, private EngineInterface $engine)
|
||||
{
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->engine = $engine;
|
||||
}
|
||||
|
||||
public function renderBox($entity, array $options): string
|
||||
|
@ -66,11 +66,11 @@ final class SummaryBudgetTest extends TestCase
|
||||
$em = $this->prophesize(EntityManagerInterface::class);
|
||||
$em->createNativeQuery(Argument::type('string'), Argument::type(Query\ResultSetMapping::class))
|
||||
->will(static function ($args) use ($queryResources, $queryCharges) {
|
||||
if (false !== strpos($args[0], 'chill_budget.resource')) {
|
||||
if (str_contains($args[0], 'chill_budget.resource')) {
|
||||
return $queryResources->reveal();
|
||||
}
|
||||
|
||||
if (false !== strpos($args[0], 'chill_budget.charge')) {
|
||||
if (str_contains($args[0], 'chill_budget.charge')) {
|
||||
return $queryCharges->reveal();
|
||||
}
|
||||
|
||||
|
@ -29,19 +29,9 @@ use TheNetworg\OAuth2\Client\Provider\Azure;
|
||||
|
||||
class AzureGrantAdminConsentAndAcquireToken extends Command
|
||||
{
|
||||
private Azure $azure;
|
||||
|
||||
private ClientRegistry $clientRegistry;
|
||||
|
||||
private MachineTokenStorage $machineTokenStorage;
|
||||
|
||||
public function __construct(Azure $azure, ClientRegistry $clientRegistry, MachineTokenStorage $machineTokenStorage)
|
||||
public function __construct(private Azure $azure, private ClientRegistry $clientRegistry, private MachineTokenStorage $machineTokenStorage)
|
||||
{
|
||||
parent::__construct('chill:calendar:msgraph-grant-admin-consent');
|
||||
|
||||
$this->azure = $azure;
|
||||
$this->clientRegistry = $clientRegistry;
|
||||
$this->machineTokenStorage = $machineTokenStorage;
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
|
@ -32,30 +32,14 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class MapAndSubscribeUserCalendarCommand extends Command
|
||||
{
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
private EventsOnUserSubscriptionCreator $eventsOnUserSubscriptionCreator;
|
||||
|
||||
private LoggerInterface $logger;
|
||||
|
||||
private MapCalendarToUser $mapCalendarToUser;
|
||||
|
||||
private MSGraphUserRepository $userRepository;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
EventsOnUserSubscriptionCreator $eventsOnUserSubscriptionCreator,
|
||||
LoggerInterface $logger,
|
||||
MapCalendarToUser $mapCalendarToUser,
|
||||
MSGraphUserRepository $userRepository
|
||||
private EntityManagerInterface $em,
|
||||
private EventsOnUserSubscriptionCreator $eventsOnUserSubscriptionCreator,
|
||||
private LoggerInterface $logger,
|
||||
private MapCalendarToUser $mapCalendarToUser,
|
||||
private MSGraphUserRepository $userRepository
|
||||
) {
|
||||
parent::__construct('chill:calendar:msgraph-user-map-subscribe');
|
||||
|
||||
$this->em = $em;
|
||||
$this->eventsOnUserSubscriptionCreator = $eventsOnUserSubscriptionCreator;
|
||||
$this->logger = $logger;
|
||||
$this->mapCalendarToUser = $mapCalendarToUser;
|
||||
$this->userRepository = $userRepository;
|
||||
}
|
||||
|
||||
public function execute(InputInterface $input, OutputInterface $output): int
|
||||
|
@ -25,13 +25,9 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class SendShortMessageOnEligibleCalendar extends Command
|
||||
{
|
||||
private BulkCalendarShortMessageSender $messageSender;
|
||||
|
||||
public function __construct(BulkCalendarShortMessageSender $messageSender)
|
||||
public function __construct(private BulkCalendarShortMessageSender $messageSender)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->messageSender = $messageSender;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
|
@ -43,34 +43,15 @@ use function count;
|
||||
|
||||
class SendTestShortMessageOnCalendarCommand extends Command
|
||||
{
|
||||
private ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder;
|
||||
|
||||
private PersonRepository $personRepository;
|
||||
|
||||
private PhoneNumberHelperInterface $phoneNumberHelper;
|
||||
|
||||
private PhoneNumberUtil $phoneNumberUtil;
|
||||
|
||||
private ShortMessageTransporterInterface $transporter;
|
||||
|
||||
private UserRepositoryInterface $userRepository;
|
||||
|
||||
public function __construct(
|
||||
PersonRepository $personRepository,
|
||||
PhoneNumberUtil $phoneNumberUtil,
|
||||
PhoneNumberHelperInterface $phoneNumberHelper,
|
||||
ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder,
|
||||
ShortMessageTransporterInterface $transporter,
|
||||
UserRepositoryInterface $userRepository
|
||||
private PersonRepository $personRepository,
|
||||
private PhoneNumberUtil $phoneNumberUtil,
|
||||
private PhoneNumberHelperInterface $phoneNumberHelper,
|
||||
private ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder,
|
||||
private ShortMessageTransporterInterface $transporter,
|
||||
private UserRepositoryInterface $userRepository
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
$this->personRepository = $personRepository;
|
||||
$this->phoneNumberUtil = $phoneNumberUtil;
|
||||
$this->phoneNumberHelper = $phoneNumberHelper;
|
||||
$this->messageForCalendarBuilder = $messageForCalendarBuilder;
|
||||
$this->transporter = $transporter;
|
||||
$this->userRepository = $userRepository;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
|
@ -24,11 +24,8 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class CalendarAPIController extends ApiController
|
||||
{
|
||||
private CalendarRepository $calendarRepository;
|
||||
|
||||
public function __construct(CalendarRepository $calendarRepository)
|
||||
public function __construct(private CalendarRepository $calendarRepository)
|
||||
{
|
||||
$this->calendarRepository = $calendarRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -49,56 +49,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class CalendarController extends AbstractController
|
||||
{
|
||||
private AccompanyingPeriodRepository $accompanyingPeriodRepository;
|
||||
|
||||
private CalendarACLAwareRepositoryInterface $calendarACLAwareRepository;
|
||||
|
||||
private DocGeneratorTemplateRepository $docGeneratorTemplateRepository;
|
||||
|
||||
private FilterOrderHelperFactoryInterface $filterOrderHelperFactory;
|
||||
|
||||
private LoggerInterface $logger;
|
||||
|
||||
private PaginatorFactory $paginator;
|
||||
|
||||
private PersonRepository $personRepository;
|
||||
|
||||
private RemoteCalendarConnectorInterface $remoteCalendarConnector;
|
||||
|
||||
private SerializerInterface $serializer;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
private UserRepositoryInterface $userRepository;
|
||||
|
||||
public function __construct(
|
||||
CalendarACLAwareRepositoryInterface $calendarACLAwareRepository,
|
||||
DocGeneratorTemplateRepository $docGeneratorTemplateRepository,
|
||||
FilterOrderHelperFactoryInterface $filterOrderHelperFactory,
|
||||
LoggerInterface $logger,
|
||||
PaginatorFactory $paginator,
|
||||
RemoteCalendarConnectorInterface $remoteCalendarConnector,
|
||||
SerializerInterface $serializer,
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
PersonRepository $personRepository,
|
||||
AccompanyingPeriodRepository $accompanyingPeriodRepository,
|
||||
UserRepositoryInterface $userRepository,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->calendarACLAwareRepository = $calendarACLAwareRepository;
|
||||
$this->docGeneratorTemplateRepository = $docGeneratorTemplateRepository;
|
||||
$this->filterOrderHelperFactory = $filterOrderHelperFactory;
|
||||
$this->logger = $logger;
|
||||
$this->paginator = $paginator;
|
||||
$this->remoteCalendarConnector = $remoteCalendarConnector;
|
||||
$this->serializer = $serializer;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->personRepository = $personRepository;
|
||||
$this->accompanyingPeriodRepository = $accompanyingPeriodRepository;
|
||||
$this->userRepository = $userRepository;
|
||||
$this->translator = $translator;
|
||||
public function __construct(private CalendarACLAwareRepositoryInterface $calendarACLAwareRepository, private DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private FilterOrderHelperFactoryInterface $filterOrderHelperFactory, private LoggerInterface $logger, private PaginatorFactory $paginator, private RemoteCalendarConnectorInterface $remoteCalendarConnector, private SerializerInterface $serializer, private TranslatableStringHelperInterface $translatableStringHelper, private PersonRepository $personRepository, private AccompanyingPeriodRepository $accompanyingPeriodRepository, private UserRepositoryInterface $userRepository, private TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,34 +33,10 @@ use UnexpectedValueException;
|
||||
|
||||
class CalendarDocController
|
||||
{
|
||||
private DocGeneratorTemplateRepository $docGeneratorTemplateRepository;
|
||||
|
||||
private EngineInterface $engine;
|
||||
|
||||
private EntityManagerInterface $entityManager;
|
||||
|
||||
private FormFactoryInterface $formFactory;
|
||||
|
||||
private Security $security;
|
||||
|
||||
private SerializerInterface $serializer;
|
||||
|
||||
private UrlGeneratorInterface $urlGenerator;
|
||||
|
||||
public function __construct(
|
||||
DocGeneratorTemplateRepository $docGeneratorTemplateRepository,
|
||||
EngineInterface $engine,
|
||||
EntityManagerInterface $entityManager,
|
||||
FormFactoryInterface $formFactory,
|
||||
Security $security,
|
||||
UrlGeneratorInterface $urlGenerator
|
||||
) {
|
||||
$this->docGeneratorTemplateRepository = $docGeneratorTemplateRepository;
|
||||
$this->engine = $engine;
|
||||
$this->entityManager = $entityManager;
|
||||
$this->formFactory = $formFactory;
|
||||
$this->security = $security;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
public function __construct(private DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private EngineInterface $engine, private EntityManagerInterface $entityManager, private FormFactoryInterface $formFactory, private Security $security, private UrlGeneratorInterface $urlGenerator)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,11 +25,8 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class CalendarRangeAPIController extends ApiController
|
||||
{
|
||||
private CalendarRangeRepository $calendarRangeRepository;
|
||||
|
||||
public function __construct(CalendarRangeRepository $calendarRangeRepository)
|
||||
public function __construct(private CalendarRangeRepository $calendarRangeRepository)
|
||||
{
|
||||
$this->calendarRangeRepository = $calendarRangeRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,17 +35,8 @@ use function in_array;
|
||||
|
||||
class InviteApiController
|
||||
{
|
||||
private EntityManagerInterface $entityManager;
|
||||
|
||||
private MessageBusInterface $messageBus;
|
||||
|
||||
private Security $security;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager, MessageBusInterface $messageBus, Security $security)
|
||||
public function __construct(private EntityManagerInterface $entityManager, private MessageBusInterface $messageBus, private Security $security)
|
||||
{
|
||||
$this->entityManager = $entityManager;
|
||||
$this->messageBus = $messageBus;
|
||||
$this->security = $security;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,16 +30,8 @@ use TheNetworg\OAuth2\Client\Token\AccessToken;
|
||||
|
||||
class RemoteCalendarConnectAzureController
|
||||
{
|
||||
private ClientRegistry $clientRegistry;
|
||||
|
||||
private OnBehalfOfUserTokenStorage $MSGraphTokenStorage;
|
||||
|
||||
public function __construct(
|
||||
ClientRegistry $clientRegistry,
|
||||
OnBehalfOfUserTokenStorage $MSGraphTokenStorage
|
||||
) {
|
||||
$this->clientRegistry = $clientRegistry;
|
||||
$this->MSGraphTokenStorage = $MSGraphTokenStorage;
|
||||
public function __construct(private ClientRegistry $clientRegistry, private OnBehalfOfUserTokenStorage $MSGraphTokenStorage)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user