Skip to content

Commit

Permalink
[Propel] Removed useless code
Browse files Browse the repository at this point in the history
  • Loading branch information
willdurand committed Feb 11, 2012
1 parent 3910735 commit 1f20fb1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 23 deletions.
12 changes: 2 additions & 10 deletions src/Symfony/Bridge/Propel1/Form/ChoiceList/ModelChoiceList.php
Expand Up @@ -18,7 +18,7 @@
use \Persistent;

/**
* Widely inspirated by the EntityChoiceList (Symfony2).
* Widely inspirated by the EntityChoiceList.
*
* @author William Durand <william.durand1@gmail.com>
*/
Expand All @@ -33,13 +33,6 @@ class ModelChoiceList extends ObjectChoiceList
*/
private $identifier = array();

/**
* TableMap
*
* @var \TableMap
*/
private $table = null;

/**
* Query
*/
Expand All @@ -66,8 +59,7 @@ public function __construct($class, $labelPath = null, $choices = null, $queryOb
$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;

Expand Down
Expand Up @@ -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.
Expand All @@ -27,16 +25,6 @@
*/
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) {
Expand Down
3 changes: 2 additions & 1 deletion src/Symfony/Bridge/Propel1/Form/Type/ModelType.php
Expand Up @@ -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());
}
}

Expand All @@ -42,6 +42,7 @@ public function getDefaultOptions(array $options)
'query' => null,
'choices' => null,
'group_by' => null,
'by_reference' => false,
);

$options = array_replace($defaultOptions, $options);
Expand Down

0 comments on commit 1f20fb1

Please sign in to comment.