-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Description
I randomly found this remark in the FAQs:
https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/faq.html#i-access-a-variable-and-its-null-what-is-wrong
I access a variable and its null, what is wrong?
If this variable is a public variable then you are violating one of the criteria for entities. All properties have to be protected or private for the proxy object pattern to work.
Is this true? All my entities have public fields, and no getters or setters, but doctrine does work fine. Also it is the first time I read that having private/protected fields with getter and setter is a must. Up to now I thought it is more or less a coding standard (and waste of space ;-))
Reactions are currently unavailable