Models data union PHP ATK

283 Views Asked by At

So I have only 1 model and 10 tables for example, I want to bring all the data from the tables into my 1 model, so I can use the Grid/Crud search/paginator etc.

If I use setSource on the grid (and not setModel), I lose pagination, quick and advanced search.

Note: Tables have no relations between them (they just have the same columns and different data) and we are talking about millions of records. Tried custom unions with DSQL but it's really slow and I have no paginator in the grid.

Any ideas ?

1

There are 1 best solutions below

0
On

Full support for UnionModel is now available as extension to Agile Data. It should easily combine 10 other models, align fields, offer you grouping support, pagination, conditions and other features you expect from a regular model.

UnionModel will automatically drop conditions, limit and aggregation down to the individual model level to make the query optimal.

More details about UnionModel are here:

http://www.agiletoolkit.org/data/extensions/report

Source: http://GitHub.com/atk4/report

Agile Data is now a separate framework, but it can be used with Agile Toolkit, you simply need to switch to branch 4.4.

If you prefer not to use this extension, you would have to manually create expression and align sub-query fields yourself.