fix: extend range of selectable years for training attendances

This commit is contained in:
Björn Fromme
2024-05-18 16:11:54 +02:00
parent ea3f2347e8
commit df67795fed
2 changed files with 6 additions and 1 deletions
@@ -39,10 +39,14 @@ class CreateController extends AbstractController
->setTraining($training) ->setTraining($training)
; ;
$yearFrom = (int) date('Y');
$yearsRange = range($yearFrom + 1, $yearFrom - 10);
$form = $this $form = $this
->createFormBuilder($attendance) ->createFormBuilder($attendance)
->add('date', AbbreviatedDateType::class, [ ->add('date', AbbreviatedDateType::class, [
'label' => 'Datum', 'label' => 'Datum',
'years' => $yearsRange,
]) ])
->getForm() ->getForm()
; ;
+2 -1
View File
@@ -25,7 +25,7 @@ class TrainingAttendance implements TimestampableEntityInterface
private ?Training $training = null; private ?Training $training = null;
#[ORM\Column(type: Types::DATE_IMMUTABLE)] #[ORM\Column(type: Types::DATE_IMMUTABLE)]
private ?\DateTimeImmutable $date = null; private ?\DateTimeImmutable $date;
#[ORM\OneToOne(cascade: ['persist', 'remove'])] #[ORM\OneToOne(cascade: ['persist', 'remove'])]
private ?Upload $certificate = null; private ?Upload $certificate = null;
@@ -36,6 +36,7 @@ class TrainingAttendance implements TimestampableEntityInterface
public function __construct() public function __construct()
{ {
$this->uuid = Uuid::v4(); $this->uuid = Uuid::v4();
$this->date = new \DateTimeImmutable();
} }
public function getId(): ?int public function getId(): ?int