Generating Models from DB in Yii?
Is there a way to automatically generate mod开发者_如何学JAVAels from a MySQL DB in YII?
You can use Gii to generate models, views and controllers for CRUD operations from tables.
You can enable Gii by inserting this code in your configuration file (uncomment it from the by yiic generated code).
'modules'=>array(
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'****',
'ipFilters'=>false, // Not recommended, but easy.
),
),
Then browse to example.com/index.php?r=gii. Login to Gii and from there the process speaks from itself.
When asked for the Model name enter *
to create models for all tables in the database.
精彩评论