<?php
namespace App\Form\Type;
use Symfony\Component\Form\AbstractType;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\OptionsResolver\OptionsResolver;
class SeasonType extends AbstractType
{
/**
* @var EntityManagerInterface
*/
private $em;
public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
}
public function configureOptions(OptionsResolver $resolver)
{
$choices = [];
for ($i = 15; $i <= 35; $i++) {
$next = $i + 1;
$choices["$i / {$next}"] = $i;
}
$resolver->setDefaults([
'choices' => $choices,
]);
}
public function getParent()
{
return ChoiceType::class;
}
}