Difference between #170 and #171 of
Yii v2 snippet guide

Revision #171 has been created by rackycz on Mar 19, 2020, 9:48:17 PM with the memo:

gii
« previous (#170) next (#172) »

Changes

Title unchanged

Yii v2 snippet guide

Category unchanged

Tutorials

Yii version unchanged

2.0

Tags unchanged

tutorial,beginner,yii2

Content changed

[...]
});
</script>

</html>
```

 
 
**Enhancing Gii**
 
---
 
If you do not like entering long model-paths and controller-paths in CRUD-generator, you can modify text boxes in "\vendor\yiisoft\yii2-gii\src\generators\crud\form.php" and enter default paths and then only manually add the name of the model.
 
 
```php
 
if (!$generator->modelClass) {
 
echo $form->field($generator, 'modelClass')->textInput(['value' => 'app\\models\\']);
 
echo $form->field($generator, 'searchModelClass')->textInput(['value' => 'app\\models\\*Search']);
 
echo $form->field($generator, 'controllerClass')->textInput(['value' => 'app\\controllers\\*Controller']);
 
} else {
 
echo $form->field($generator, 'modelClass');
 
echo $form->field($generator, 'searchModelClass');
 
echo $form->field($generator, 'controllerClass');
 
}
 
```
 
7 0
4 followers
Viewed: 275 000 times
Version: 2.0
Category: Tutorials
Written by: rackycz
Last updated by: rackycz
Created on: Sep 19, 2019
Last updated: a year ago
Update Article

Revisions

View all history