This commit is contained in:
Julien Fastré 2023-05-01 21:22:56 +02:00
parent 07c681fcec
commit 737f5f9275
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
2 changed files with 22 additions and 23 deletions

View File

@ -47,7 +47,23 @@ use function array_key_exists;
final class ActivityController extends AbstractController 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,
)
{ {
} }

View File

@ -23,10 +23,9 @@ use Doctrine\ORM\Mapping as ORM;
class ActivityReason class ActivityReason
{ {
/** /**
* @var bool
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
*/ */
private $active = true; private bool $active = true;
/** /**
* @var ActivityReasonCategory * @var ActivityReasonCategory
@ -34,7 +33,7 @@ class ActivityReason
* targetEntity="Chill\ActivityBundle\Entity\ActivityReasonCategory", * targetEntity="Chill\ActivityBundle\Entity\ActivityReasonCategory",
* inversedBy="reasons") * inversedBy="reasons")
*/ */
private $category; private ?ActivityReasonCategory $category = null;
/** /**
* @var int * @var int
@ -43,13 +42,13 @@ class ActivityReason
* @ORM\Column(name="id", type="integer") * @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO") * @ORM\GeneratedValue(strategy="AUTO")
*/ */
private $id; private ?int $id = null;
/** /**
* @var array * @var array
* @ORM\Column(type="json") * @ORM\Column(type="json")
*/ */
private $name; private array $name;
/** /**
* Get active. * Get active.
@ -81,25 +80,9 @@ class ActivityReason
/** /**
* Get name. * 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; return $this->name;
} }