mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
57 lines
1.4 KiB
PHP
57 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Chill\CustomFieldsBundle\Form;
|
|
|
|
use Symfony\Component\Form\AbstractType;
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
|
use Chill\CustomFieldsBundle\Form\Type\CustomFieldType;
|
|
|
|
class BlopEntityType extends AbstractType
|
|
{
|
|
/**
|
|
* @param FormBuilderInterface $builder
|
|
* @param array $options
|
|
*/
|
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
{
|
|
$entityManager = $options['em'];
|
|
|
|
$builder
|
|
->add('field1')
|
|
->add('field2')
|
|
//->add('adress', new AdressType())
|
|
->add('customField', 'custom_field')
|
|
;
|
|
}
|
|
|
|
/**
|
|
* @param OptionsResolverInterface $resolver
|
|
*/
|
|
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
|
{
|
|
$resolver->setDefaults(array(
|
|
'data_class' => 'Chill\CustomFieldsBundle\Entity\BlopEntity',
|
|
'cascade_validation' => true
|
|
));
|
|
|
|
// supprimer ça en definissant dans services
|
|
$resolver->setRequired(array(
|
|
'em',
|
|
));
|
|
|
|
$resolver->setAllowedTypes(array(
|
|
'em' => 'Doctrine\Common\Persistence\ObjectManager',
|
|
));
|
|
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getName()
|
|
{
|
|
return 'cl_customfieldsbundle_blopentity';
|
|
}
|
|
}
|