[Propel] Removed useless code

This commit is contained in:
William DURAND 2012-02-11 01:15:30 +01:00
parent 3910735784
commit 1f20fb1b7d
3 changed files with 4 additions and 23 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -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);