Skip to content
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

Add support for nested models #183

Closed
romaninsh opened this issue Oct 5, 2016 · 2 comments
Closed

Add support for nested models #183

romaninsh opened this issue Oct 5, 2016 · 2 comments
Labels

Comments

@romaninsh
Copy link
Member

We need a proxy persistence. For one it will be really useful for Forms. Here is how I think it should work.

  1. You create blank model and associate it with Proxy persistence.
  2. You can add multiple models through a special method, and specify which fields you want to import.
  3. Importing fields will copy all the properties
  4. When you execute save() then $data[] is simply copied into relevant models then save() is executed on those models.
  5. If multiple linked models exist within same persistence, we group them into atomic() operation.
  6. There should be a way on how to link models. E.g. create "User" and "User_Contact", but the second should receive user_id value.
  7. Proxy model can be saved into session easily if we want for multi-record operations.
  8. Proxy can be used recursively (just a test no practical use).
  9. Extra hooks.
  10. Fields can be imported in a different order.
  11. Support groups.
  12. Support iterating. One model will be main, but other model will be intelligently pre-fetched and results connected.
  13. Support grouping/aggregation. (not sure how yet)
  14. Some support for switching nested model persistences (e.g. load from cache, but update back to API)
  15. Support for order and limit

Proxy will be used extensively by Views (in Agile/UI). Adding field into Form will add it into proxy. Using setModel() will import bunch of fields into proxy. The same goes for Grid.

Proxies will quite often use a custom Field class. Proxy can also type-cast into formats that are designed for presenting, e.g. format date using locale, etc.

@mvorisek mvorisek changed the title Proxy persistence Add support for nested models Aug 25, 2021
@mvorisek
Copy link
Member

mvorisek commented Aug 25, 2021

I think the correct approach is to support any Model as another Model source/table. Ideally RW if not grouped.

@mvorisek
Copy link
Member

implemented in #946

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants