You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are cases when ActiveRecord instances should be used in readonly mode. For example, readonly tables or views (virtual tables) and views for rendering responses.
For these cases ReadOnlyActiveRecordInterface interface could be created and realized in ReadOnlyActiveRecord class.
Updated 16.05.2024
Found related issue with naming ImmutableActiveRecord
Activity
samdark commentedon May 15, 2024
Can we use native PHP readonly properties (PHP 8.1) and classes (PHP 8.2) for the purpose?
Tigrov commentedon May 16, 2024
Looks like a solution but still can be deleted using
$model->delete()vjik commentedon May 18, 2024
May be add this feature in PHP 8.2 only? It will to allow check readonly class in
delete()method and throw exception in this case.Tigrov commentedon May 21, 2024
Seems
readonlyclass is not suitable due to relations stored in$relationproperty. And the relations can be loaded in several operations.