mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-883: "private" properties and proxy classes. #1096
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Nov 18, 2010).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user fumanchu182:
When creating entities I usually create properties with the access level of private. However this prevents Proxy classes from retrieving data via **get or. For example the class
This generates a proxy class that has the following mapping for get:
However the call from a proxy class to lets say $image->getUser()->id; will generate the following error:
Undefined property via __get(): id in /var/www/sites/foobar/library/Application/Entity/Proxy/Application_Entity_UserProxy.php on line
This is due to the access declaration in the original class. I filed this as a bug since I know a lot of the documentation has properties of entities defined as private. Changing those declarations to protected alleviates this issue and also does not introduce any security risks or break the OOP access security. With all this being said if I have missed documentation that says please make all entity properties "protected" ignore this and delete.