[Form] improve error message with a "hasser" hint for PropertyAccessDeniedException

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: no, but fails exactly the same as without this fix
Fixes the following tickets: -
Todo: -
License of the code: MIT
Documentation PR: symfony/symfony-docs#1958
This commit is contained in:
Philipp Rieber 2012-11-24 15:41:49 +01:00
parent 1c0ba78833
commit 06ee53b73e

View File

@ -425,7 +425,7 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface
$result[self::VALUE] = $objectOrArray->$property;
} elseif ($reflClass->hasProperty($property)) {
if (!$reflClass->getProperty($property)->isPublic()) {
throw new PropertyAccessDeniedException(sprintf('Property "%s" is not public in class "%s". Maybe you should create the method "%s()" or "%s()"?', $property, $reflClass->name, $getter, $isser));
throw new PropertyAccessDeniedException(sprintf('Property "%s" is not public in class "%s". Maybe you should create the method "%s()" or "%s()" or "%s()"?', $property, $reflClass->name, $getter, $isser, $hasser));
}
$result[self::VALUE] =& $objectOrArray->$property;