<?php
namespace App\Form;
use App\Entity\Note;
use App\Entity\User;
use App\Entity\Movie;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\RangeType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
class NoteType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('noteDesc', TextareaType::class)
->add('note', ChoiceType::class, [
'choices' => [
'1' => 1,
'2' => 2,
'3' => 3,
'4' => 4,
'5' => 5,
],
'expanded' => true
]);
// ->add('idUser', EntityType::class, [
// 'class' => User::class,
// 'choice_label' => function (User $user) {
// return $user->getEmail();
// },
// ])
// ->add('idMovie', EntityType::class, [
// 'class' => Movie::class,
// 'choice_label' => function (Movie $movie) {
// return $movie->getTitle();
// },
// ])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Note::class,
]);
}
}