简体   繁体   中英

Yii Gii Crudcode Object Access The Model of Our Input

i'm trying to modify my gii... that's legal isn't it??

I'm trying to modify crud form generator so that the generator will generate form for current relational model..

i can do that if i modify the CActiveFormWidget, but it dont generate the code to the _form file...

so i need to modify the form by gii CRUD generator.

how do i access and create/instantiate the Model supplied by our input?

I could only get the Model class name.. What i need is the model it self..

EDITED :

Found it!

simply just :

$obj = new $this->modelClass();

at file _form.php

Yay!

other solution :

$obj = new $this->getModelClass();

btw, do you have tried yiibooster ? http://yiibooster.clevertech.biz/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM