mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
DX: rector rules upt to PHP 74
This commit is contained in:
@@ -143,14 +143,10 @@ class AccompanyingPeriodContext implements
|
||||
->add('category', EntityType::class, [
|
||||
'placeholder' => 'Choose a document category',
|
||||
'class' => DocumentCategory::class,
|
||||
'query_builder' => static function (EntityRepository $er) {
|
||||
return $er->createQueryBuilder('c')
|
||||
->where('c.documentClass = :docClass')
|
||||
->setParameter('docClass', AccompanyingCourseDocument::class);
|
||||
},
|
||||
'choice_label' => function ($entity = null) {
|
||||
return $entity ? $this->translatableStringHelper->localize($entity->getName()) : '';
|
||||
},
|
||||
'query_builder' => static fn(EntityRepository $er) => $er->createQueryBuilder('c')
|
||||
->where('c.documentClass = :docClass')
|
||||
->setParameter('docClass', AccompanyingCourseDocument::class),
|
||||
'choice_label' => fn($entity = null) => $entity ? $this->translatableStringHelper->localize($entity->getName()) : '',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -160,9 +156,7 @@ class AccompanyingPeriodContext implements
|
||||
public function buildPublicForm(FormBuilderInterface $builder, DocGeneratorTemplate $template, mixed $entity): void
|
||||
{
|
||||
$options = $template->getOptions();
|
||||
$persons = new ArrayCollection($entity->getCurrentParticipations()->map(static function (AccompanyingPeriodParticipation $p) {
|
||||
return $p->getPerson();
|
||||
})->toArray());
|
||||
$persons = new ArrayCollection($entity->getCurrentParticipations()->map(static fn(AccompanyingPeriodParticipation $p) => $p->getPerson())->toArray());
|
||||
|
||||
foreach ($entity->getCurrentParticipations() as $p) {
|
||||
foreach ($p->getPerson()->getResources() as $r) {
|
||||
@@ -187,9 +181,7 @@ class AccompanyingPeriodContext implements
|
||||
$builder->add($key, EntityType::class, [
|
||||
'class' => Person::class,
|
||||
'choices' => $persons,
|
||||
'choice_label' => function (Person $p) {
|
||||
return $this->personRender->renderString($p, ['addAge' => true]);
|
||||
},
|
||||
'choice_label' => fn(Person $p) => $this->personRender->renderString($p, ['addAge' => true]),
|
||||
'multiple' => false,
|
||||
'expanded' => true,
|
||||
'required' => false,
|
||||
|
@@ -63,9 +63,7 @@ class AccompanyingPeriodWorkEvaluationContext implements
|
||||
$this->accompanyingPeriodWorkContext->adminFormReverseTransform($data),
|
||||
[
|
||||
'evaluations' => array_map(
|
||||
static function (Evaluation $e) {
|
||||
return $e->getId();
|
||||
},
|
||||
static fn(Evaluation $e) => $e->getId(),
|
||||
$data['evaluations']
|
||||
),
|
||||
]
|
||||
@@ -78,9 +76,7 @@ class AccompanyingPeriodWorkEvaluationContext implements
|
||||
$this->accompanyingPeriodWorkContext->adminFormTransform($data),
|
||||
[
|
||||
'evaluations' => array_map(
|
||||
function ($id) {
|
||||
return $this->evaluationRepository->find($id);
|
||||
},
|
||||
fn($id) => $this->evaluationRepository->find($id),
|
||||
$data['evaluations'] ?? []
|
||||
),
|
||||
]
|
||||
@@ -97,9 +93,7 @@ class AccompanyingPeriodWorkEvaluationContext implements
|
||||
'class' => Evaluation::class,
|
||||
'label' => 'Linked evaluations',
|
||||
'choices' => $this->evaluationRepository->findAll(),
|
||||
'choice_label' => function (Evaluation $e) {
|
||||
return $this->translatableStringHelper->localize($e->getTitle());
|
||||
},
|
||||
'choice_label' => fn(Evaluation $e) => $this->translatableStringHelper->localize($e->getTitle()),
|
||||
'multiple' => true,
|
||||
'attr' => ['class' => 'select2'],
|
||||
]);
|
||||
|
@@ -126,14 +126,10 @@ final class PersonContext implements PersonContextInterface
|
||||
->add('category', EntityType::class, [
|
||||
'placeholder' => 'Choose a document category',
|
||||
'class' => DocumentCategory::class,
|
||||
'query_builder' => static function (EntityRepository $er) {
|
||||
return $er->createQueryBuilder('c')
|
||||
->where('c.documentClass = :docClass')
|
||||
->setParameter('docClass', PersonDocument::class);
|
||||
},
|
||||
'choice_label' => function ($entity = null) {
|
||||
return $entity ? $this->translatableStringHelper->localize($entity->getName()) : '';
|
||||
},
|
||||
'query_builder' => static fn(EntityRepository $er) => $er->createQueryBuilder('c')
|
||||
->where('c.documentClass = :docClass')
|
||||
->setParameter('docClass', PersonDocument::class),
|
||||
'choice_label' => fn($entity = null) => $entity ? $this->translatableStringHelper->localize($entity->getName()) : '',
|
||||
'required' => true,
|
||||
]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user