Table of Contents
7. Gii Support
6.10. Soft Documents Models
« Previous
8. Special Topics
Next »

7. Gii Support

AuthorDariusz Górecki

Model generation

Since version 1.3.4 you can generate mongo document models based on existing SQL tables, just enable gii generators provided within package (see below) and use MongoModel generator.

CRUD Generation

Now you can generate CRUD for yours MongoDB Documents! just you have to add generator path to yours Gii config

By default generated models will use mongo _id field as a primary key (using MongoId class) this generator will use different field as a primary key, if you will override primaryKey() method to return something different than '_id'. Note that generator cannot handle with multifield primary key,

// in yours main.php config file:
'modules'=>array(
    // ...
 
    'gii'=>array(
        'class'=>'system.gii.GiiModule',
        'password'=>'yours_password_to_gii',
        // add additional generator path
        'generatorPaths'=>array(
            'ext.YiiMongoDbSuite.gii'
        ),
    ),
 
    // ...
),
// Now login to Gii and start using Mongocrud generator !

Forms generation

7. Gii Support
Table of Contents
« Previous
6.10. Soft Documents Models
Next »
8. Special Topics