Hi,
I am getting a CException Property "GiiModule.db" is not defined error when creating a CRUD for my module in Gii.
../config/main.php
modules=>(
'booksImported'=>array(
'db'=>array(
'connectionString'=>'mysql:host=localhost;dbname=dbimports',
'username' => 'root',
'password' => 'unl0ck',
'class'=>'CDbConnection'
)
)
My module …protected\modules\booksImported\BooksImportedModule.php
class BooksImportedModule extends CWebModule
{
public $db
public function init()
...
}
My module model …\protected\modules\booksImported\models\Importedbooks.php
class Importedbooks extends CActiveRecord
{
...
public function getDbConnection()
{
$db = Yii::app()->controller->module->db;
return Yii::createComponent($db);
}
}
I’ve put the following in Crud generator
Model Class * : application.modules.booksImported.models.Importedbooks
Controller ID * : importedbooks
Base Controller Class *: Controller //also tried with my module main controller under /booksImported/components/[controller name]
...
I have managed to create a CRUD for modules that uses the same db as main App, And also managed to create a model for this module…i’m js struggling with the CRUD