From 71614218c0fdc0addb9cfdc0d617bc494bab6ade Mon Sep 17 00:00:00 2001 From: genemu Date: Sun, 14 Dec 2014 14:38:48 +0100 Subject: [PATCH] Move deprecated PropertyAccess::getPropertyAccessor() in sf2.3 --- Form/JQuery/Type/AutocompleteType.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Form/JQuery/Type/AutocompleteType.php b/Form/JQuery/Type/AutocompleteType.php index 9020be74..a9b7731d 100644 --- a/Form/JQuery/Type/AutocompleteType.php +++ b/Form/JQuery/Type/AutocompleteType.php @@ -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) + )); } }