Model To Create And Manage Multiple Tables Of The Same Type

So I’ve been doing a bit of digging and trying to figure out how to achieve this. Let’s say I have a site with multiple members. Each member is allowed to create lists (eg shopping list, favorite music list, tv show list, etc.). I’d like to store each list in a separate table.

Is there a way that a single model could manage the creation and CRUD of the tables in the database? I’d like to be able to pass inputs to the model to know which table to operate on or to create a new table altogether.

Although I haven’t yet reached this part of development in my site, it’s been a constant question in the back of my mind and I’d like to get some ideas for it so I can jump right in when the time comes.

Looks like I would need to implement the tableName method from ActiveRecord. So would something like this work?




public static function tableName($name)

    {

        return $name;

    }