Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
systems:yii2:modules [2018/03/30 11:10] smayr [Using Custom Database] |
systems:yii2:modules [2018/04/18 09:56] (current) smayr [Using Custom Database] |
||
---|---|---|---|
Line 61: | Line 61: | ||
' | ' | ||
' | ' | ||
+ | // Main application database | ||
' | ' | ||
- | 'tablePrefix' => 'module_', | + | 'class' => 'yii\db\Connection', |
], | ], | ||
+ | // Custom module database | ||
+ | //' | ||
+ | // ' | ||
+ | // ' | ||
+ | // ' | ||
+ | // ' | ||
+ | // ' | ||
+ | // ' | ||
+ | //], | ||
], | ], | ||
], | ], | ||
Line 212: | Line 222: | ||
' | ' | ||
// Option 1: custom database for module | // Option 1: custom database for module | ||
- | //' | + | |
- | //' | + | // In @app/ |
+ | | ||
+ | // | ||
+ | // In @app/ | ||
+ | //' | ||
+ | // DIRECTORY_SEPARATOR | ||
+ | | ||
+ | | ||
+ | // DIRECTORY_SEPARATOR . 'config' . | ||
+ | | ||
+ | //), | ||
| | ||
// Option 2: custom database for module | // Option 2: custom database for module | ||
Line 243: | Line 263: | ||
{ | { | ||
return " | return " | ||
+ | | ||
+ | // NOTE: To query the raw table name, use the following: | ||
+ | // echo Yii:: | ||
+ | // Displays as follows (assuming ' | ||
+ | // | ||
} | } | ||
| | ||
Line 257: | Line 282: | ||
// instead of getting a connection from app (using Yii:: | // instead of getting a connection from app (using Yii:: | ||
| | ||
- | | + | |
} | } | ||
| | ||
Line 265: | Line 290: | ||
== References == | == References == | ||
- | * [[http:// | + | * [[http:// |
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// |