Skip to content

Commit 2f271a6

Browse files
committed
[Cookbook] Remove deprectated call to PropertyPath
1 parent 8d6d6c3 commit 2f271a6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cookbook/form/create_form_type_extension.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ it in the view::
194194
use Symfony\Component\Form\AbstractTypeExtension;
195195
use Symfony\Component\Form\FormView;
196196
use Symfony\Component\Form\FormInterface;
197-
use Symfony\Component\Form\Util\PropertyPath;
197+
use Symfony\Component\PropertyAccess\PropertyAccess;
198198
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
199199

200200
class ImageTypeExtension extends AbstractTypeExtension
@@ -232,8 +232,8 @@ it in the view::
232232
$parentData = $form->getParent()->getData();
233233

234234
if (null !== $parentData) {
235-
$propertyPath = new PropertyPath($options['image_path']);
236-
$imageUrl = $propertyPath->getValue($parentData);
235+
$accessor = PropertyAccess::getPropertyAccessor();
236+
$imageUrl = $accessor->getValue($parentData, $options['image_path']);
237237
} else {
238238
$imageUrl = null;
239239
}

0 commit comments

Comments
 (0)