Form types

devFront
root 2018-06-06 11:59:23 +02:00
parent e647714baf
commit 8d9b89d73d
3 changed files with 17 additions and 7 deletions

View File

@ -7,14 +7,13 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use ApiPlatform\Core\Annotation\ApiResource; use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Annotation\ApiSubresource; use ApiPlatform\Core\Annotation\ApiSubresource;
use App\Service\QuestionAPI;
/** /**
* @ApiResource( * @ApiResource(
* collectionOperations={"get"={"method"="GET"}}, * collectionOperations={"get"={"method"="GET"}},
* itemOperations={ * itemOperations={
* "get"={"method"="GET"}, * "get"={"method"="GET"},
* "special"={"route_name"="api_questions_first", "requirements"={}} * "special"={"route_name"="api_questions_first"}
* } * }
* ) * )
* @ORM\Table(name="question") * @ORM\Table(name="question")

View File

@ -3,6 +3,7 @@
namespace App\Form; namespace App\Form;
use App\Entity\Question; use App\Entity\Question;
use Doctrine\DBAL\Types\TextType;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
@ -12,8 +13,12 @@ class QuestionType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder $builder
->add('text') ->add('text', null, [
->add('sticker') 'attr' => ['class' => 'form-control'],
])
->add('sticker', null, [
'attr' => ['class' => 'form-control'],
])
; ;
} }

View File

@ -12,9 +12,15 @@ class ResponseType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder $builder
->add('text') ->add('text', null, [
->add('question') 'attr' => ['class' => 'form-control'],
->add('child') ])
->add('question', null, [
'attr' => ['class' => 'form-control'],
])
->add('child', null, [
'attr' => ['class' => 'form-control'],
])
; ;
} }