How to create a Model in Yii2 with increase of table every month

Hi,
I have a bio-metric system that produce staff attendance records every month. The system creates a new table every month. The name of example table as follow:

  • Jan 2020: att202001
  • Feb 2020: att202002
  • Mac 2020: att202003
  • April 2019: att201904
    and so on.

I want to develop an application using Yii2 to read the table direct to system. How can I create a model that read all the tables from the system ? TQ.

How about creating an SQL view that prepares data in the format you need?

Thanks for reply. As I know creating view from static table name. For your information the database is firebase. How to create view to add new table monthly ?

In google firebase docs a couple of links that may provide some ideas:
query tables using wildcard
and
using views

Bear in mind views will have to be changed each month when a new table is created, and will become big and slow.

Brain dump follows as I don’t work with firebase
I assume firebase will allow you to get a list of tables and filter those down to those you need. It may be possible to use that filtered list to create a Yii controller and model that accepts any table name from a select list or uri.

ActiveModel is not the only fruit. In Yii you can create sql statements on the fly to concatenate a table name into the query. The API Database Access objects may provide ideas, though may not support firebase directly.

TQ for your reply. So far I think the best way is create a pure PHP RESTful API inside the firebase server, then let the Yii2 app process the REST data. :sweat_smile:

Sounds like an overkill but I’m not firebase expert either.