Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error due to deprecation of Symfony\Component\Form\Util\PropertyPath #16

Open
isabellebruchet opened this issue Oct 7, 2013 · 5 comments

Comments

@isabellebruchet
Copy link

I have this fatal error after symfony vendor upgrade, trying to use "entity_id" :

FatalErrorException: Error: Class 'Symfony\Component\Form\Util\PropertyPath' not found in vendor/gregwar/form-bundle/Gregwar/FormBundle/DataTransformer/EntityToIdTransformer.php line 85

PropertyPath class is apparently deprecated.

@isabellebruchet
Copy link
Author

Just have to replace :
$propertyPath = new PropertyPath($this->property);
return $propertyPath->getValue($data);

By :
$propertyAccessor = new PropertyAccessor();
return $propertyAccessor->getValue($data, $this->property);

And change the use statement :
use Symfony\Component\PropertyAccess\PropertyAccessor;

@Gregwar
Copy link
Owner

Gregwar commented Oct 7, 2013

Is this compatible with older sf versions?

2013/10/7 isabellebruchet notifications@github.com

Just have to replace :
$propertyPath = new PropertyPath($this->property);
return $propertyPath->getValue($data);

By :
$propertyAccessor = new PropertyAccessor();
return $propertyAccessor->getValue($data, $this->property);

And change the use statement :
use Symfony\Component\PropertyAccess\PropertyAccessor;


Reply to this email directly or view it on GitHubhttps://github.com//issues/16#issuecomment-25808681
.

Grégoire Passault

@isabellebruchet
Copy link
Author

Apparently these new files exist since version 2.2, however, the code I posted above works, but it is not exactly the right way. PropertyAccessor should not be accessed directly but via PropertyAccess.

@isabellebruchet
Copy link
Author

Right way : isabellebruchet@d4ab026

@Koc
Copy link
Contributor

Koc commented Jun 1, 2015

Is this bug still occurs? Imho this issue can be closed.

@isabellebruchet, @Gregwar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants