Documentation wrong? #6086

Closed
opened 2026-01-22 15:26:33 +01:00 by admin · 4 comments
Owner

Originally created by @flaushi on GitHub (Oct 11, 2018).

Originally assigned to: @Majkl578 on GitHub.

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

Originally created by @flaushi on GitHub (Oct 11, 2018). Originally assigned to: @Majkl578 on GitHub. 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 ;-))
admin added the BugDocumentation labels 2026-01-22 15:26:33 +01:00
admin closed this issue 2026-01-22 15:26:33 +01:00
Author
Owner

@Ocramius commented on GitHub (Oct 15, 2018):

@flaushi yes, that's something that was fixed in doctrine/orm 2.4, where we allowed proxying public properties.

If you want to help with the docs, send a patch to remove that paragraph :-)

@Ocramius commented on GitHub (Oct 15, 2018): @flaushi yes, that's something that was fixed in `doctrine/orm` 2.4, where we allowed proxying `public` properties. If you want to help with the docs, send a patch to remove that paragraph :-)
Author
Owner

@stollr commented on GitHub (Oct 18, 2018):

I have created a PR to remove that paragraph ;-)

@stollr commented on GitHub (Oct 18, 2018): I have created a PR to remove that paragraph ;-)
Author
Owner

@flaushi commented on GitHub (Oct 18, 2018):

Thanks! I wanted to do the same but could not find the paragraph anymore. I tought it had beed deleted already... anyway thanks!

@flaushi commented on GitHub (Oct 18, 2018): Thanks! I wanted to do the same but could not find the paragraph anymore. I tought it had beed deleted already... anyway thanks!
Author
Owner

@Majkl578 commented on GitHub (Nov 11, 2018):

#7434 merged.

@Majkl578 commented on GitHub (Nov 11, 2018): #7434 merged.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6086