From 8d9b89d73dac675b9fa9bcae85c3539a28681277 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 6 Jun 2018 11:59:23 +0200 Subject: [PATCH] Form types --- src/Entity/Question.php | 3 +-- src/Form/QuestionType.php | 9 +++++++-- src/Form/ResponseType.php | 12 +++++++++--- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/Entity/Question.php b/src/Entity/Question.php index a043854..3e4e18c 100644 --- a/src/Entity/Question.php +++ b/src/Entity/Question.php @@ -7,14 +7,13 @@ use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use ApiPlatform\Core\Annotation\ApiResource; use ApiPlatform\Core\Annotation\ApiSubresource; -use App\Service\QuestionAPI; /** * @ApiResource( * collectionOperations={"get"={"method"="GET"}}, * itemOperations={ * "get"={"method"="GET"}, - * "special"={"route_name"="api_questions_first", "requirements"={}} + * "special"={"route_name"="api_questions_first"} * } * ) * @ORM\Table(name="question") diff --git a/src/Form/QuestionType.php b/src/Form/QuestionType.php index 4d5eff3..f3e6066 100644 --- a/src/Form/QuestionType.php +++ b/src/Form/QuestionType.php @@ -3,6 +3,7 @@ namespace App\Form; use App\Entity\Question; +use Doctrine\DBAL\Types\TextType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -12,8 +13,12 @@ class QuestionType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('text') - ->add('sticker') + ->add('text', null, [ + 'attr' => ['class' => 'form-control'], + ]) + ->add('sticker', null, [ + 'attr' => ['class' => 'form-control'], + ]) ; } diff --git a/src/Form/ResponseType.php b/src/Form/ResponseType.php index 0887001..5c93766 100644 --- a/src/Form/ResponseType.php +++ b/src/Form/ResponseType.php @@ -12,9 +12,15 @@ class ResponseType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('text') - ->add('question') - ->add('child') + ->add('text', null, [ + 'attr' => ['class' => 'form-control'], + ]) + ->add('question', null, [ + 'attr' => ['class' => 'form-control'], + ]) + ->add('child', null, [ + 'attr' => ['class' => 'form-control'], + ]) ; }