Skip to content

Documentation wrong? #7427

@flaushi

Description

@flaushi

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 ;-))

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions