DDC-1072: Private property mapping can cause issues, suggest changing to protected #1341

Closed
opened 2026-01-22 13:11:02 +01:00 by admin · 1 comment
Owner

Originally created by @doctrinebot on GitHub (Mar 17, 2011).

Originally assigned to: @billschaller on GitHub.

Jira issue originally created by user kevbradwick:

The documentation recommends using private variables in entities. This can be problematic on entities with relations when using caching drivers as the proxy objects cannot access private variables and so the caching driver can throw notices like

...apc_store(): "_id" returned as member variable from __sleep() but
does not exist in ...

Making member variables protected resolves this issue when caching is enabled.

This information would be helpful on the documentation so others can be made aware of this issue. We spent a few days trying to debug the issue before understanding exactly what was going on.

Originally created by @doctrinebot on GitHub (Mar 17, 2011). Originally assigned to: @billschaller on GitHub. Jira issue originally created by user kevbradwick: The documentation recommends using private variables in entities. This can be problematic on entities with relations when using caching drivers as the proxy objects cannot access private variables and so the caching driver can throw notices like ...apc_store(): "_id" returned as member variable from __sleep() but does not exist in ... Making member variables protected resolves this issue when caching is enabled. This information would be helpful on the documentation so others can be made aware of this issue. We spent a few days trying to debug the issue before understanding exactly what was going on.
admin added the Documentation label 2026-01-22 13:11:02 +01:00
admin closed this issue 2026-01-22 13:11:04 +01:00
Author
Owner
@billschaller commented on GitHub (Jan 5, 2016): Addressed in http://doctrine-orm.readthedocs.org/projects/doctrine-orm/en/latest/reference/architecture.html#entities
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1341