doctrine-website
doctrine-website copied to clipboard
Update `2022-01-11-orm-2.11.md` to be clear about some limitations over "Support for Readonly Properties"
The support for read only properties only works fine for entities which use the "None" strategy for identifier generator. When the entity use other strategy, like the suggested in the documentation, an exception is thrown when you try to remove the entity.
See:
- https://github.com/doctrine/orm/issues/10032
- https://github.com/doctrine/orm/blob/2.14.x/lib/Doctrine/ORM/UnitOfWork.php#L1271-L1273
- https://github.com/doctrine/orm/blob/2.14.x/lib/Doctrine/ORM/Mapping/ReflectionReadonlyProperty.php#L46
- https://www.php.net/manual/en/language.oop5.properties.php#language.oop5.properties.readonly-properties
- https://3v4l.org/FrhLN
Hi @n4huel, and thank you for your contribution. This is a blog post from January 2022 about ORM 2.11. I don't know if an old blog post is supposed to be changed.
@beberlei how do you see it? should we adapt an old blog post? I'm asking you because this is one you've created.
Thanks you @SenseException, your point is accurate. Maybe it should include some note/disclaimer update as "errata" since the feature isn't really supported.
"it will not work" is also limited to the id field. Other fields can still be readonly.