<?php
namespace App\Form;
use App\Entity\User;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
class WidgetNotesType extends AbstractType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('dateAt', DateType::class, array(
'widget' => 'single_text',
'format' => 'yyyy-MM-dd'
))
->add('title', TextType::class)
->add('message', TextType::class)
->add('forAgent', EntityType::class, array(
'class' => User::class,
'choice_label' => 'name',
'choice_value' => 'id',
'expanded' => false,
'multiple' => false,
'placeholder' => 'Select a For Agent'))
->add('audience', CheckboxType::class)
->add('save', SubmitType::class)
;
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'App\Entity\WidgetNotes'
));
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'appbundle_widgetnotes';
}
}