-
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
Model: excludeFields() function would be nice #319
Comments
This is very similar to #118 |
@georgehristov you mean exclude some model fields or exclude one field from the database dable (eg. query database for all available field first)? |
Field names are taken from data Model not actual DB table fields. Issue can arise if we use both these functions at the same time - onlyFields() and excludeFields(). These can clash then so we have to define priority of these. But idea as such is good. Usage example - we never want user to load password field from database, so why not just Another example - model can contain some fields which include complex select logic from nested tables which works slow on load. If we don't need to load this field always, then we can exclude this field from load (like lazy loading of some kind). |
fine, can be useful
that should result in an exception |
closing in favor of #118 |
Hi,
at the moment there is the possibility to define onlyFields, and only these fields will be loaded.
The ability to do the reverse, to exclude some fields, would be great:
Imagine you have a model with 50 fields and you want to exclude 2 for some reason. That makes quite a long onlyFields parameter :)
Same case again, but in future the model may get additional fields. Now excluding the 2 fields via onlyFields() may lead to failures in future, as onlyFields was used with the intention to only exclude these 2 fields - it will also exclude any newly added field of the model if onlyFields code is not altered.
The text was updated successfully, but these errors were encountered: