September 12, 2012, 11:42am
I am completely new to Yii, used to work on PHP without a framework.
My question is:
I expect to have several thousand users at a time, and each has about 100 records (rows) of data.
I was thinking of dynamically creating an individual table for each user upon registration, for performance reasons.
I know how to create tables dynamically through PHP, but how do I create a model-controller for each (model+crud) programmatically ?
If your user tables have the same schema then you can create only one model and define method tableName in it, returning appropriate table name depending on some condition (for example, user session var, or some model property).
PS. IMHO table switching should be done by DB.
For example, this is how it can be managed in PostgreSQL: