src/Form/NoteType.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\Note;
  4. use App\Entity\User;
  5. use App\Entity\Movie;
  6. use Symfony\Component\Form\AbstractType;
  7. use Symfony\Component\Form\FormBuilderInterface;
  8. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  9. use Symfony\Component\OptionsResolver\OptionsResolver;
  10. use Symfony\Component\Form\Extension\Core\Type\RangeType;
  11. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  12. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  13. class NoteType extends AbstractType
  14. {
  15.     public function buildForm(FormBuilderInterface $builder, array $options): void
  16.     {
  17.         $builder
  18.             ->add('noteDesc'TextareaType::class)
  19.             ->add('note'ChoiceType::class, [
  20.                 'choices' => [
  21.                     '1' => 1,
  22.                     '2' => 2,
  23.                     '3' => 3,
  24.                     '4' => 4,
  25.                     '5' => 5,
  26.                 ],
  27.                 'expanded' => true
  28.             ]);
  29.             // ->add('idUser', EntityType::class, [ 
  30.             //     'class' => User::class,
  31.             //     'choice_label' => function (User $user) {
  32.             //         return $user->getEmail();
  33.             //     },
  34.             // ])
  35.             // ->add('idMovie', EntityType::class, [ 
  36.             //     'class' => Movie::class,
  37.             //     'choice_label' => function (Movie $movie) {
  38.             //         return $movie->getTitle();
  39.             //     },
  40.             // ])
  41.         ;
  42.     }
  43.     public function configureOptions(OptionsResolver $resolver): void
  44.     {
  45.         $resolver->setDefaults([
  46.             'data_class' => Note::class,
  47.         ]);
  48.     }
  49. }