diff --git a/src/Controller/Admin/Teamer/TrainingAttendance/CreateController.php b/src/Controller/Admin/Teamer/TrainingAttendance/CreateController.php index c73a5b4..cc4b421 100644 --- a/src/Controller/Admin/Teamer/TrainingAttendance/CreateController.php +++ b/src/Controller/Admin/Teamer/TrainingAttendance/CreateController.php @@ -39,10 +39,14 @@ class CreateController extends AbstractController ->setTraining($training) ; + $yearFrom = (int) date('Y'); + $yearsRange = range($yearFrom + 1, $yearFrom - 10); + $form = $this ->createFormBuilder($attendance) ->add('date', AbbreviatedDateType::class, [ 'label' => 'Datum', + 'years' => $yearsRange, ]) ->getForm() ; diff --git a/src/Entity/TrainingAttendance.php b/src/Entity/TrainingAttendance.php index 6eb9315..99ff759 100644 --- a/src/Entity/TrainingAttendance.php +++ b/src/Entity/TrainingAttendance.php @@ -25,7 +25,7 @@ class TrainingAttendance implements TimestampableEntityInterface private ?Training $training = null; #[ORM\Column(type: Types::DATE_IMMUTABLE)] - private ?\DateTimeImmutable $date = null; + private ?\DateTimeImmutable $date; #[ORM\OneToOne(cascade: ['persist', 'remove'])] private ?Upload $certificate = null; @@ -36,6 +36,7 @@ class TrainingAttendance implements TimestampableEntityInterface public function __construct() { $this->uuid = Uuid::v4(); + $this->date = new \DateTimeImmutable(); } public function getId(): ?int