Skip to content

Commit

Permalink
Move deprecated PropertyAccess::getPropertyAccessor() in sf2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
genemu committed Dec 14, 2014
1 parent fe1c5b5 commit 7161421
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Form/JQuery/Type/AutocompleteType.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,16 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
$objects = $options['em']->getRepository($options['class'])->findAll();
foreach ($objects as $object) {
if ($propertyPath) {
$suggestions[] = PropertyAccess::getPropertyAccessor()->getValue($object, $propertyPath);
$suggestions[] = PropertyAccess::createPropertyAccessor()->getValue($object, $propertyPath);
} elseif (method_exists($object, '__toString')) {
$suggestions[] = (string) $object;
} else {
throw new \RuntimeException('Cannot cast object of type "'.get_class($object).'" to string, please implement a __toString method or set the "property" option to the desired value.');
throw new \RuntimeException(sprintf(
'Cannot cast object of type "%s" to string, ' .
'please implement a __toString method or ' .
'set the "property" option to the desired value.',
get_class($object)
));
}
}

Expand Down

0 comments on commit 7161421

Please sign in to comment.