This commit is contained in:
William DURAND 2014-05-16 11:33:58 +02:00
parent a88e7d8278
commit fa92011126
3 changed files with 7 additions and 5 deletions

View File

@ -223,15 +223,18 @@ class FormTypeParser implements ParserInterface
}
}
private function handleChoiceListValues(ChoiceListInterface $choiceList) {
private function handleChoiceListValues(ChoiceListInterface $choiceList)
{
$choices = array();
foreach (array($choiceList->getPreferredViews(), $choiceList->getRemainingViews()) as $viewList) {
$choices = array_merge($choices, $this->handleChoiceViewsHierarchy($viewList));
}
return $choices;
}
private function handleChoiceViewsHierarchy(array $choiceViews) {
private function handleChoiceViewsHierarchy(array $choiceViews)
{
$choices = array();
foreach ($choiceViews as $item) {
if ($item instanceof ChoiceView) {
@ -240,6 +243,7 @@ class FormTypeParser implements ParserInterface
$choices = array_merge($choices, $this->handleChoiceViewsHierarchy($item));
}
}
return $choices;
}
}

View File

@ -8,7 +8,6 @@
namespace Nelmio\ApiDocBundle\Tests\Fixtures\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList;
use Symfony\Component\Form\FormBuilderInterface;
@ -53,4 +52,3 @@ class ImprovedTestType extends AbstractType
return '';
}
}

View File

@ -148,4 +148,4 @@ test_route_private:
test_route_exclusive:
pattern: /exclusive
defaults: { _controller: NelmioApiDocTestBundle:Test:exclusive }
defaults: { _controller: NelmioApiDocTestBundle:Test:exclusive }