From 737f5f927510fb550a34a2c509ee4d1f2e5c58b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 1 May 2023 21:22:56 +0200 Subject: [PATCH] fixes --- .../Controller/ActivityController.php | 18 ++++++++++++- .../Entity/ActivityReason.php | 27 ++++--------------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 3ea61c0cf..69d3f3312 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -47,7 +47,23 @@ use function array_key_exists; final class ActivityController extends AbstractController { - 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) + 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, + ) { } diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php b/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php index 9d1e88409..99504f469 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php @@ -23,10 +23,9 @@ use Doctrine\ORM\Mapping as ORM; class ActivityReason { /** - * @var bool * @ORM\Column(type="boolean") */ - private $active = true; + private bool $active = true; /** * @var ActivityReasonCategory @@ -34,7 +33,7 @@ class ActivityReason * targetEntity="Chill\ActivityBundle\Entity\ActivityReasonCategory", * inversedBy="reasons") */ - private $category; + private ?ActivityReasonCategory $category = null; /** * @var int @@ -43,13 +42,13 @@ class ActivityReason * @ORM\Column(name="id", type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ - private $id; + private ?int $id = null; /** * @var array * @ORM\Column(type="json") */ - private $name; + private array $name; /** * Get active. @@ -81,25 +80,9 @@ class ActivityReason /** * Get name. - * - * @param mixed|null $locale */ - public function getName($locale = null): array|string + public function getName(): array { - if ($locale) { - if (isset($this->name[$locale])) { - return $this->name[$locale]; - } - - foreach ($this->name as $name) { - if (!empty($name)) { - return $name; - } - } - - return ''; - } - return $this->name; }