src/Form/Type/IntensityType.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Form\Type;
  3. use App\Entity\Exercise;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  6. use Symfony\Component\OptionsResolver\OptionsResolver;
  7. class IntensityType extends AbstractType
  8. {
  9.     public function configureOptions(OptionsResolver $resolver)
  10.     {
  11.         $choices = [
  12.           "label.".Exercise::DIFICULTY_TYPE_HIGH  => Exercise::DIFICULTY_TYPE_HIGH,
  13.           "label.".Exercise::DIFICULTY_TYPE_MEDIUM  => Exercise::DIFICULTY_TYPE_MEDIUM,
  14.           "label.".Exercise::DIFICULTY_TYPE_LOW => Exercise::DIFICULTY_TYPE_LOW,
  15.         ];
  16.         $resolver->setDefaults([
  17.           'choices' => $choices,
  18.         ]);
  19.     }
  20.     public function getParent()
  21.     {
  22.         return ChoiceType::class;
  23.     }
  24. }