mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-3603: Readonly columns #4427
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Mar 6, 2015).
Jira issue originally created by user sparrowek:
Sometimes I have a column that is calculated (or have a default value) at the database side. When inserting a new record doctrine issues NULL into such a column that causes problems on some DBMS. I would like to annotate such columns as readonly so that doctrine would skip them in INSERT and UPDATE clauses but still fetch them in SELECT clauses.
@Hikariii commented on GitHub (Mar 21, 2016):
Issued a PR for exactly this: https://github.com/doctrine/doctrine2/pull/5728
@Hikariii commented on GitHub (Jun 15, 2016):
@beberlei This becomes more urgent as more people start using mysql 5.7 and generated columns.
See #5728 for more details on why this is important.
@Ocramius commented on GitHub (Jun 15, 2016):
Described my thoughts about this feature in https://github.com/doctrine/doctrine2/pull/5728
@dbu commented on GitHub (Feb 26, 2019):
as #5728 has been closed, should this be closed too?
if you write your query in dbal, you can completely hide columns from ORM with a schema listener. the column won't be mapped on the entity however, and is not available for DQL / ORM query builder.
@0xPaul commented on GitHub (Dec 20, 2021):
This should not be closed because, as far as I can tell, there still isn't support for read-only generated columns within the ORM.
@garak commented on GitHub (Feb 11, 2022):
Readonly on primary keys is not working for me. As soon as I try to hydrate the object, the UnitOfWork tries to call
setValuemethod on the property, resulting in an exception ("Attempting to change readonly property My\Entity\Foo::$id.")@derrabus commented on GitHub (Feb 15, 2022):
@garak The ticket you are commenting on has nothing to with the PHP language feature
readonly. Please file a bug for your issue.@beberlei commented on GitHub (Feb 16, 2022):
This was implemented in 2.11 as virtual and generated columns