-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Description
| Q | A |
|---|---|
| Bug report? | yes |
| Feature request? | no |
| BC Break report? | no |
| RFC? | no |
| Symfony version | master |
I had (incorrectly) architected myself into a situation where I have an entity without a setter for a property, and when trying to hydrate the entity from a FormType, I would get the following exception:
Could not determine access type for property "property" in class "AppBundle\Entity\MyEntity".
I'm not always a smart man, so it wasn't immediately obvious what that message meant. It took me dumping the contents of the $access array before it clicked:
/var/www/vendor/symfony/symfony/src/Symfony/Component/PropertyAccess/PropertyAccessor.php:653:
array(3) {
[0] =>
bool(true)
[1] =>
int(4)
[2] =>
string(190) "Neither the property "property" nor one of the methods "addProperty()"/"removeProperty()", "setProperty()", "property()", "__set()" or "__call()" exist and have public access in class "AppBundle\Entity\MyEntity"."
}
Long story short: I believe the NoSuchPropertyException that is thrown should include the $access[self::ACCESS_NAME] if it exists.
Thank you!