mootensai / yii2-enhanced-gii

Enhanced Yii2 Gii (generator) that generates related Models & CRUD
MIT License
203 stars 98 forks source link

error with IO Generator (CRUD) generated files #145

Closed scryba closed 6 years ago

scryba commented 6 years ago

I keep getting this error

::1:51393 [500]: /hello/ - Method yii\widgets\ActiveField::__toString() must not throw an exception, caught Error: Class 'common\models\Yii' not found in F:\yii2\helloproject\backend\views\hello\_search.php on line 0

::1:51312 [500]: /hello/create - Method yii\widgets\ActiveField::__toString() must not throw an exception, caught Error: Class 'common\models\Yii' not found in F:\\yii2\helloproject\backend\views\hello\_form.php on line 0

I generated with IO Generator (CRUD)

if remove codes below in F:\\yii2\helloproject\backend\views\hello\index.php works fine.

<?php echo $this->render('_search', ['model' => $searchModel]); ?>

<div class="search-form" style="display:none">
    <?=  $this->render('_search', ['model' => $searchModel]); ?>
</div>
scryba commented 6 years ago

Found the problem. Always make sure the model extending the base model should have defined;

use Yii;