One Model to access many Tables in Same Database having similar structure

Hi all, i just started with yii, re-building a project for learning purposes, Now, I had almost 60 Tables, in 4 databases, and creating a model for each of them would be very tedious and would cost a lot of coffee, so i searched for a way to access all the Tables(all have same structure) in a single database, but i found nothing i could use, so i made this little piece of code that allows me to access different tables, depending upon the url parameter, from a Single Model.

Changes/additions made :

Define a new class(static),

//stat.php in /models


 class stat

{public static $tbName;

public static function SetTbName($param)

{self::$tbName = $param;}

public static function GetTbName()

{ return self::$tbName;}



in controller.php

public function actionIndex1()



		$model=new Stat();



		else Stat::SetTbName('result');

		$model=new Result('search');



in modelName.php

public function tableName()


		return Stat::GetTbName();



Hey =) you can use console.

>> model TableName1

>> model TableName2

>> model TableName3

>> model TableName4

>> model TableName…

>> model TableName…

>> model TableName…

>> model TableName60

you just need "model <TableName>" command for creating a model and

you just need "crud <ModelClassName>" command for creating a crud

few seconds for all your 60 table.

I am new to yii, does doing this way i be able to retail all my edits in the model and controller, or do i need to alter the code according to my needs in all 60 files?