Last active
April 30, 2018 21:26
-
-
Save Cperbony/eab6b92729aa0ff07b98ff93ed59bf2f to your computer and use it in GitHub Desktop.
Curso Symfony 4 - Microjobs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Form; | |
use App\Entity\Categoria; | |
use App\Entity\Servico; | |
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |
use Symfony\Component\Form\AbstractType; | |
use Symfony\Component\Form\Extension\Core\Type\FileType; | |
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |
use Symfony\Component\Form\FormBuilderInterface; | |
use Symfony\Component\OptionsResolver\OptionsResolver; | |
class ServicoType extends AbstractType | |
{ | |
public function buildForm(FormBuilderInterface $builder, array $options) | |
{ | |
$builder | |
->add('titulo') | |
->add('valor') | |
->add('descricao') | |
->add('informacoes_adicionais') | |
->add('prazo_entrega') | |
->add('status') | |
->add('imagem', FileType::class) | |
->add('categorias', EntityType::class, [ | |
'class' => Categoria::class, | |
'choice_name' => 'nome', | |
'multiple' => true, | |
'expanded' => true | |
]) | |
->add("bt_salvar", SubmitType::class, [ | |
'label' => "Salvar" | |
]) | |
; | |
} | |
public function configureOptions(OptionsResolver $resolver) | |
{ | |
$resolver->setDefaults([ | |
'data_class' => Servico::class, | |
]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment