add form post
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
8b9735b75c
commit
1d3ef1bfb8
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Post;
|
||||
use App\Entity\Species;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
|
||||
class PostType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('foundDate', null, [
|
||||
'widget' => 'single_text',
|
||||
])
|
||||
->add('latitude')
|
||||
->add('longitude')
|
||||
->add('altitude')
|
||||
->add('commentary')
|
||||
->add('species', EntityType::class, [
|
||||
'class' => Species::class,
|
||||
'choice_label' => 'scientific_name',
|
||||
])
|
||||
->add('save', SubmitType::class, ['label' => 'Create Post']);
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Post::class,
|
||||
]);
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{{ form_start(form, {'attr': {'novalidate': 'novalidate'}}) }}
|
||||
{{ form_widget(form) }}
|
||||
{{ form_end(form) }}
|
Loading…
Reference in new issue