mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-20 01:04:23 +00:00
remove unused form type
This commit is contained in:
parent
edd74b710b
commit
960ba13555
@ -1,52 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\CustomFieldsBundle\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
|
||||
/**
|
||||
* @internal Ne fonctionne pas encore
|
||||
*/
|
||||
class AdressType extends AbstractType
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @param FormBuilderInterface $builder
|
||||
* @param array $options
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('data', 'entity', array(
|
||||
|
||||
))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsResolverInterface $resolver
|
||||
*/
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||
{
|
||||
// $resolver->setDefaults(array(
|
||||
// 'data_class' => 'Chill\CustomFieldsBundle\Entity\Adress',
|
||||
// 'class' => 'Chill\CustomFieldsBundle\Entity\Adress'
|
||||
// ));
|
||||
}
|
||||
|
||||
public function getParent()
|
||||
{
|
||||
return 'entity';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'adress';
|
||||
}
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\CustomFieldsBundle\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
|
||||
class BlopEntity2Type extends AbstractType
|
||||
{
|
||||
/**
|
||||
* @param FormBuilderInterface $builder
|
||||
* @param array $options
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$em = $options['em'];
|
||||
|
||||
$customFields = $em
|
||||
->getRepository('ChillCustomFieldsBundle:CustomField')
|
||||
->findAll();
|
||||
|
||||
foreach ($customFields as $cf) {
|
||||
if($cf->getType() === 'ManyToOne(Adress)') {
|
||||
$builder->add($cf->getLabel(), 'entity', array(
|
||||
'class' => 'ChillCustomFieldsBundle:Adress',
|
||||
'property' => 'data'
|
||||
));
|
||||
} else if ($cf->getType() === 'ManyToOnePersist(Adress)') {
|
||||
$builder->add($cf->getLabel(), new AdressType());
|
||||
} else if($cf->getType() === 'ManyToMany(Adress)') {
|
||||
$builder->add($cf->getLabel(), 'entity', array(
|
||||
'class' => 'ChillCustomFieldsBundle:Adress',
|
||||
'property' => 'data',
|
||||
'multiple' => true
|
||||
));
|
||||
} else if ($cf->getType() === 'text') {
|
||||
$builder->add($cf->getLabel(), 'text');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsResolverInterface $resolver
|
||||
*/
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => 'Chill\CustomFieldsBundle\Entity\BlopEntity2'
|
||||
));
|
||||
|
||||
// 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_blopentity2';
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
<?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';
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user