feat: Add a new `readonly` property to Model fields definition
See original GitHub issuereadonly will be a boolean property by default set to false.
Its operation can be something like:
- when an instance is created or updated, if the field haven’t a value yet, then can be set without triggering a
readonlyerror. - once the field has a value, any further modification attempt will trigger a
readonlyerror.
This come in handy when manipulating this kind of fields, which is a common use case I think (I’ve the need of this kind of model fields across several different projects).
So, what do you think?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:11
- Comments:24 (12 by maintainers)
Top Results From Across the Web
c# - How to implement a read only property - Stack Overflow
readonly class fields are often used for variables that are initialized during class construction, and will never be changed later on. In short ......
Read more >readonly keyword - C# Reference - Microsoft Learn
The readonly keyword is a modifier that can be used in four contexts: In a field declaration, readonly indicates that assignment to the...
Read more >Mapping Table Columns - SQLAlchemy 1.4 Documentation
Mapping Table Columns¶. Introductory background on mapping to columns falls under the subject of Table configuration; the general form falls ...
Read more >Declare and Initialize Read-only Auto Properties in C# ...
When you define fields, you should make sure you define them as private as this ensures you are not violating the concept of...
Read more >What's New in PHP 8.1? Features, Changes, Improvements ...
Pure Intersection Types; Enums; The never Return Type; Fibers; New readonly Properties; Define final Class Constants; New fsync() and ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This definetly should be in core. ReadOnly option is a must have for ORMs.
Please consider it as core feature, gentlemen.