Navigation Menu

Skip to content

Commit

Permalink
use preferred_choices in favor of preferred_query
Browse files Browse the repository at this point in the history
  • Loading branch information
havvg committed Dec 21, 2012
1 parent 6855cff commit 05fca6d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Expand Up @@ -340,7 +340,11 @@ protected function createValue($model)
private function load()
{
$models = (array) $this->query->find();
$preferred = (array) $this->preferredQuery->find();

$preferred = array();
if ($this->preferredQuery instanceof ModelCriteria) {
$preferred = (array) $this->preferredQuery->find();
}

try {
// The second parameter $labels is ignored by ObjectChoiceList
Expand Down
7 changes: 3 additions & 4 deletions src/Symfony/Bridge/Propel1/Form/Type/ModelType.php
Expand Up @@ -24,7 +24,7 @@
* @author William Durand <william.durand1@gmail.com>
* @author Toni Uebernickel <tuebernickel@gmail.com>
*
* Example using the preferred_query option.
* Example using the preferred_choices option.
*
* <code>
* public function buildForm(FormBuilderInterface $builder, array $options)
Expand All @@ -38,7 +38,7 @@
* ->orderByName()
* ->endUse()
* ,
* 'preferred_query' => ProductQuery::create()
* 'preferred_choices' => ProductQuery::create()
* ->filterByIsTopProduct(true)
* ,
* ))
Expand All @@ -64,7 +64,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
$options['choices'],
$options['query'],
$options['group_by'],
$options['preferred_query']
$options['preferred_choices']
);
};

Expand All @@ -79,7 +79,6 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
'choice_list' => $choiceList,
'group_by' => null,
'by_reference' => false,
'preferred_query' => null,
));
}

Expand Down

0 comments on commit 05fca6d

Please sign in to comment.