How to reuse models

Hi everyone,

We’re gonna migrate all our apps to Yii. My colleagues and me have no experience with this framework, but all of us think is the right for us to accomplish this task.

We have a doubt:

How can we make reusable models so all of our apps can use common tables like cities or states without making the same model in every new app we develop.

Thanks in advanced.

Sorry for my english.

you can keep them in separate directory, then create alias for this directory and add it to default search like this:

(config main.php)

Yii::setPathOfAlias( 'common', '/opt/common' ); 

return array(

	'basePath'=>dirname( dirname( __FILE__ ) ),

	'name'=>'Yii Application',








and that’s all. you can reference models simply by using them:

$model = new CommonModel();

Red Guy, you’re the man!!