-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Saving an entity with a modified field which excludes them from model results in error #967
Comments
Model is currently a domain/scope, eg. violation any conditions must always throw/rollback and never allow to save out-of-scope model data. What you need is to have a Model /wo such filtering conditions and then close it for filtering an unread messages. But when saving such message as read, you must use the unfiltered model or remove the filtering cond before save. Please post also the traversing back and forth case which might be solveable, but here is nothing we can do. The only thing I think we can do is introduce a flag to every condition marking if such condition is filtering one or a model/hard one, if non-hard, we can ignore such condition on save. |
Even if we will ignore conditions set outside Model::init(), it is not logical to be able to save a record that cannot be selected later Typical usecase is softdelete. I belive such usecase, and answer/solution for you?, is to temporary relax/ignore such condition during save in try&finally (remove&restore) approach |
Reopening as in Discord discussion. Also see branch https://github.com/atk4/data/tree/save_wo_scope |
I am closing this issue. We can discuss it under your PR. No need for 2 places. |
Steps to reproduce:
Current workaround: change reaload_after_save of model to false.
Problem for developers:
Saving values to entity which might result that they no longer are part of a model with conditions happens regularly.
Idea:
The reload will be performed to the model without conditions to ensure entity can be found.
The text was updated successfully, but these errors were encountered: