yii2yii2-advanced-appgii

Yii2 - Generating CRUD from all models


After creating all database tables in MySQL or MariaDB, I am able to generate all Yii2 Models using gii by simple entering * and voila, all models are created.

My question; I was wondering if there's an equivalent way of generating all CRUD - at once - based on generated models in a similar way, either from the console with a one-liner or from the browser with the gii CRUD Generator.


Solution

  • Answer:

    Not using standard "yiisoft/yii2-gii" unfortunately. You can compare the "generate()" functions for the model and crud to get a programmatic reason here:

    Model: https://github.com/yiisoft/yii2-gii/blob/master/src/generators/model/Generator.php

    CRUD: https://github.com/yiisoft/yii2-gii/blob/master/src/generators/crud/Generator.php


    Solution:

    I hope these help.