[Form] only use PropertyPath if not already callable

This commit is contained in:
Tobias Schultze 2015-08-15 21:15:17 +02:00
parent f79c48718c
commit 470b1400d6
1 changed files with 7 additions and 7 deletions

View File

@ -84,7 +84,7 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface
*/ */
public function createListFromChoices($choices, $value = null) public function createListFromChoices($choices, $value = null)
{ {
if (is_string($value)) { if (is_string($value) && !is_callable($value)) {
$value = new PropertyPath($value); $value = new PropertyPath($value);
} }
@ -134,7 +134,7 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface
*/ */
public function createListFromLoader(ChoiceLoaderInterface $loader, $value = null) public function createListFromLoader(ChoiceLoaderInterface $loader, $value = null)
{ {
if (is_string($value)) { if (is_string($value) && !is_callable($value)) {
$value = new PropertyPath($value); $value = new PropertyPath($value);
} }
@ -164,7 +164,7 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface
{ {
$accessor = $this->propertyAccessor; $accessor = $this->propertyAccessor;
if (is_string($label)) { if (is_string($label) && !is_callable($label)) {
$label = new PropertyPath($label); $label = new PropertyPath($label);
} }
@ -174,7 +174,7 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface
}; };
} }
if (is_string($preferredChoices)) { if (is_string($preferredChoices) && !is_callable($preferredChoices)) {
$preferredChoices = new PropertyPath($preferredChoices); $preferredChoices = new PropertyPath($preferredChoices);
} }
@ -189,7 +189,7 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface
}; };
} }
if (is_string($index)) { if (is_string($index) && !is_callable($index)) {
$index = new PropertyPath($index); $index = new PropertyPath($index);
} }
@ -199,7 +199,7 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface
}; };
} }
if (is_string($groupBy)) { if (is_string($groupBy) && !is_callable($groupBy)) {
$groupBy = new PropertyPath($groupBy); $groupBy = new PropertyPath($groupBy);
} }
@ -213,7 +213,7 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface
}; };
} }
if (is_string($attr)) { if (is_string($attr) && !is_callable($attr)) {
$attr = new PropertyPath($attr); $attr = new PropertyPath($attr);
} }