Yii model generation

218 views Asked by At

you know that using gii tool we can generate models and view controllers, so, the question is : Is it possible to generate a model without using the gii tool, I mean, just doing it through the php code like calling some method giving required parameters to it and so on?

1

There are 1 answers

0
user7282 On

If you want to create a model called company, create a file named Company.php in models folder and add the following

namespace app\models;

use yii\db\ActiveRecord;

class Company extends ActiveRecord {
 // add your functions and properties here

}

N.B. : This is for the latest version of Yii, ie Yii 2.0