mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Upgrade changes from master to last rector rules
This commit is contained in:
parent
9375d50112
commit
899ed5d0a4
@ -35,7 +35,7 @@ class AsideActivity implements TrackCreationInterface, TrackUpdateInterface
|
||||
/**
|
||||
* @ORM\Column(type="datetime")
|
||||
*/
|
||||
private $createdAt;
|
||||
private ?\DateTimeInterface $createdAt = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
@ -46,7 +46,7 @@ class AsideActivity implements TrackCreationInterface, TrackUpdateInterface
|
||||
/**
|
||||
* @ORM\Column(type="datetime")
|
||||
*/
|
||||
private $date;
|
||||
private ?\DateTimeInterface $date = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="time", nullable=true)
|
||||
@ -69,18 +69,18 @@ class AsideActivity implements TrackCreationInterface, TrackUpdateInterface
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
private $note;
|
||||
private ?string $note = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=AsideActivityCategory::class, inversedBy="asideActivities")
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
private $type;
|
||||
private ?\Chill\AsideActivityBundle\Entity\AsideActivityCategory $type = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime", nullable=true)
|
||||
*/
|
||||
private $updatedAt;
|
||||
private ?\DateTimeInterface $updatedAt = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
|
@ -20,7 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class ByLocationAggregator implements AggregatorInterface
|
||||
{
|
||||
public function __construct(private LocationRepository $locationRepository)
|
||||
public function __construct(private readonly LocationRepository $locationRepository)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -33,43 +33,19 @@ use Doctrine\ORM\QueryBuilder;
|
||||
use LogicException;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
||||
final readonly 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,
|
||||
private EntityManagerInterface $em,
|
||||
private DateTimeHelper $dateTimeHelper,
|
||||
private UserHelper $userHelper,
|
||||
private ScopeRepositoryInterface $scopeRepository,
|
||||
private CenterRepositoryInterface $centerRepository,
|
||||
private AsideActivityCategoryRepository $asideActivityCategoryRepository,
|
||||
private CategoryRender $categoryRender,
|
||||
private LocationRepository $locationRepository,
|
||||
TranslatableStringHelperInterface $translatableStringHelper
|
||||
private 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 buildForm(FormBuilderInterface $builder)
|
||||
@ -98,19 +74,15 @@ 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) {
|
||||
return match ($key) {
|
||||
'id', 'note' => static function ($value) use ($key) {
|
||||
if ('_header' === $value) {
|
||||
return 'export.aside_activity.' . $key;
|
||||
}
|
||||
|
||||
return $value ?? '';
|
||||
};
|
||||
|
||||
case 'duration':
|
||||
return static function ($value) use ($key) {
|
||||
},
|
||||
'duration' => static function ($value) use ($key) {
|
||||
if ('_header' === $value) {
|
||||
return 'export.aside_activity.' . $key;
|
||||
}
|
||||
@ -124,19 +96,10 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
||||
}
|
||||
|
||||
return $value;
|
||||
};
|
||||
|
||||
case 'createdAt':
|
||||
case 'updatedAt':
|
||||
case 'date':
|
||||
return $this->dateTimeHelper->getLabel('export.aside_activity.' . $key);
|
||||
|
||||
case 'agent_id':
|
||||
case 'creator_id':
|
||||
return $this->userHelper->getLabel($key, $values, 'export.aside_activity.' . $key);
|
||||
|
||||
case 'aside_activity_type':
|
||||
return function ($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';
|
||||
}
|
||||
@ -146,10 +109,8 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
||||
}
|
||||
|
||||
return $this->categoryRender->renderString($c, []);
|
||||
};
|
||||
|
||||
case 'location':
|
||||
return function ($value) {
|
||||
},
|
||||
'location' => function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return 'export.aside_activity.location';
|
||||
}
|
||||
@ -159,10 +120,8 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
||||
}
|
||||
|
||||
return $l->getName();
|
||||
};
|
||||
|
||||
case 'main_scope':
|
||||
return function ($value) {
|
||||
},
|
||||
'main_scope' => function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return 'export.aside_activity.main_scope';
|
||||
}
|
||||
@ -172,10 +131,8 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
||||
}
|
||||
|
||||
return $this->translatableStringHelper->localize($c->getName());
|
||||
};
|
||||
|
||||
case 'main_center':
|
||||
return function ($value) {
|
||||
},
|
||||
'main_center' => function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return 'export.aside_activity.main_center';
|
||||
}
|
||||
@ -186,11 +143,9 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
||||
}
|
||||
|
||||
return $c->getName();
|
||||
},
|
||||
default => throw new LogicException('this key is not supported : ' . $key),
|
||||
};
|
||||
|
||||
default:
|
||||
throw new LogicException('this key is not supported : ' . $key);
|
||||
}
|
||||
}
|
||||
|
||||
public function getQueryKeys($data)
|
||||
|
@ -42,8 +42,11 @@ class MembersEditor
|
||||
|
||||
private array $persistables = [];
|
||||
|
||||
public function __construct(private readonly ValidatorInterface $validator, private readonly ?\Chill\PersonBundle\Entity\Household\Household $household, private readonly EventDispatcherInterface $eventDispatcher)
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ValidatorInterface $validator,
|
||||
private readonly ?\Chill\PersonBundle\Entity\Household\Household $household,
|
||||
private readonly EventDispatcherInterface $eventDispatcher
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
@ -160,8 +163,6 @@ class MembersEditor
|
||||
*
|
||||
* Makes a person leave the household **associated with this editor**.
|
||||
*
|
||||
* @param DateTimeImmutable $date
|
||||
* @param Person $person
|
||||
* @return $this
|
||||
*/
|
||||
public function leaveMovement(
|
||||
|
Loading…
x
Reference in New Issue
Block a user