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 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")

View File

@ -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'],
])
;
}

View File

@ -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'],
])
;
}