2

i am new to Yii Framework and i am trying to call the gii model generator dynamically from code, i cant find any sample to do this. So is there any way to call model generators and CRUD generator dynamically ?

Mothana
  • 41
  • 10
  • Why do you want to generate the CRUD and the modules out of the code? Sorry, but i don't see the sense – Dinistro Oct 27 '14 at 08:39
  • 1
    in my app the user can generate his own tables based on what options he want to use, long story :) .... but i really want this ! – Mothana Oct 27 '14 at 08:53
  • if it is just about table generation, then you can simply build an SQL query out of the options and run it? – Rami Dabain Oct 27 '14 at 09:39
  • yes i know that ! but i want the model for many reasons ... – Mothana Oct 27 '14 at 10:06
  • dude , this link may helps you , try this , http://stackoverflow.com/questions/18144254/yii-generate-a-model-file-using-php-code-instead-of-gii-tool – ramamoorthy_villi Oct 27 '14 at 14:27
  • mmm... very old... but hope it helps http://stackoverflow.com/questions/41123218/yii-generate-model-without-gii/41255865#41255865 – Alejandro Quiroz Dec 22 '16 at 17:29

1 Answers1

0
First you go /protected/config/main.php and un-comment the following code.

    'modules'=>array(
    'gii'=>array(
                'class'=>'system.gii.GiiModule',
                'password'=>'1',
                // If removed, Gii defaults to localhost only. Edit carefully to taste.
                'ipFilters'=>array('127.0.0.1','::1'),
            ),
    ),

then go through url localhost/../index.php?r=gii
jithin
  • 920
  • 9
  • 17