public static function getDb() {return Yii::$app->get('db_o');} is missing
lowap opened this issue · 1 comments
lowap commented
What steps will reproduce the problem?
- create a new config file for connecting oracle db e.g. config/db_o.php
- define
'db_o' => require(__DIR__ . '/db_o.php'),
in config/web.php - generate model class with giiant using connection
db_o
- try to generate giiant CRUD for class generated using connection
db_o
What's expected?
that CRUD generator is using public static function getDb() {return Yii::$app->get('db_o');}
of class
(standard gii is generating it)
What do you get instead?
public static function getDb() {return Yii::$app->get('db_o');}
is missing in model class, so error message: Invalid Configuration - The table does not exist
Additional info
Q | A |
---|---|
Yii version | 2.0.11.2 |
PHP version | 5.6.25 wampserver 3.0.6 64bit |
Operating system | Windows Server 2012 R2 |
schmunk42 commented
You can work around that issue by using the giiant-module
which has a ConnectionTrait
, which you can use to specify a custom db connection in your models. But you can also use just the trait.
You can generate traits into models (and controllers, btw) with --baseTraits
or --modelBaseTraits
(batch command).