<?php
namespace App\Form;
use App\Entity\Company;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
//use Symfony\Component\Form\Extension\Core\Type\ChoiceList;
class CompanyType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('business_name',null,[
'label'=>'Denomination entreprise'])
->add('street_address',null,[
'label'=>'Adresse'])
->add('state',null,[
'label'=>'Ville'])
->add('mobile',null,[
'label'=>'Mobile',
'required' => false,]
)
->add('email',null,[
'label'=>'Mail',
'required' => false,])
->add('website',null,[
'label'=>'Site web',
'required' => false,])
->add('categories',ChoiceType::class,[
'choices'=>$this->getChoices()
]
)
->add('company_presentation')
->add('facebook', null, [
'label'=>'Facebook',
'required' => false,
])
->add('visite',null,[
'label'=>'Souhaitez-vous recevoir notre commercial '])
->add('annonce',null,[
'label'=>'Souhaitez-vouz avoir une annonce sur les annaires'])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => Company::class,
]);
}
private function getChoices()
{
$choices=Company::CATEGORY;
$output=[];
foreach ($choices as $key => $value) {
$output[$value]=$key;
}
return $output;
}
}