[Propel] Removed useless code
This commit is contained in:
parent
3910735784
commit
1f20fb1b7d
@ -18,7 +18,7 @@ use Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList;
|
||||
use \Persistent;
|
||||
|
||||
/**
|
||||
* Widely inspirated by the EntityChoiceList (Symfony2).
|
||||
* Widely inspirated by the EntityChoiceList.
|
||||
*
|
||||
* @author William Durand <william.durand1@gmail.com>
|
||||
*/
|
||||
@ -33,13 +33,6 @@ class ModelChoiceList extends ObjectChoiceList
|
||||
*/
|
||||
private $identifier = array();
|
||||
|
||||
/**
|
||||
* TableMap
|
||||
*
|
||||
* @var \TableMap
|
||||
*/
|
||||
private $table = null;
|
||||
|
||||
/**
|
||||
* Query
|
||||
*/
|
||||
@ -66,8 +59,7 @@ class ModelChoiceList extends ObjectChoiceList
|
||||
$queryClass = $this->class . 'Query';
|
||||
$query = new $queryClass();
|
||||
|
||||
$this->table = $query->getTableMap();
|
||||
$this->identifier = $this->table->getPrimaryKeys();
|
||||
$this->identifier = $query->getTableMap()->getPrimaryKeys();
|
||||
$this->query = $queryObject ?: $query;
|
||||
$this->loaded = is_array($choices) || $choices instanceof \Traversable;
|
||||
|
||||
|
@ -11,13 +11,11 @@
|
||||
|
||||
namespace Symfony\Bridge\Propel1\Form\DataTransformer;
|
||||
|
||||
use Symfony\Bridge\Propel1\Form\ChoiceList\ModelChoiceList;
|
||||
use Symfony\Component\Form\DataTransformerInterface;
|
||||
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||
use Symfony\Component\Form\Exception\TransformationFailedException;
|
||||
|
||||
use \PropelCollection;
|
||||
use \PropelObjectCollection;
|
||||
|
||||
/**
|
||||
* CollectionToArrayTransformer class.
|
||||
@ -27,16 +25,6 @@ use \PropelObjectCollection;
|
||||
*/
|
||||
class CollectionToArrayTransformer implements DataTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @var \Symfony\Bridge\Propel1\Form\ChoiceList\ModelChoiceList
|
||||
*/
|
||||
private $choiceList;
|
||||
|
||||
public function __construct(ModelChoiceList $choiceList)
|
||||
{
|
||||
$this->choiceList = $choiceList;
|
||||
}
|
||||
|
||||
public function transform($collection)
|
||||
{
|
||||
if (null === $collection) {
|
||||
|
@ -27,7 +27,7 @@ class ModelType extends AbstractType
|
||||
public function buildForm(FormBuilder $builder, array $options)
|
||||
{
|
||||
if ($options['multiple']) {
|
||||
$builder->prependClientTransformer(new CollectionToArrayTransformer($options['choice_list']));
|
||||
$builder->prependClientTransformer(new CollectionToArrayTransformer());
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,6 +42,7 @@ class ModelType extends AbstractType
|
||||
'query' => null,
|
||||
'choices' => null,
|
||||
'group_by' => null,
|
||||
'by_reference' => false,
|
||||
);
|
||||
|
||||
$options = array_replace($defaultOptions, $options);
|
||||
|
Reference in New Issue
Block a user