From 8325f7a8909cc726e08963e4f533279dc95c478b Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sat, 25 May 2013 03:33:43 +0400 Subject: [PATCH] Added db component. Added configuration section to readme. --- apps/advanced/README.md | 12 ++++++++++++ apps/advanced/backstage/config/main.php | 1 + apps/advanced/common/config/params.php | 7 +++++++ apps/advanced/console/config/main.php | 1 + apps/advanced/frontend/config/main.php | 1 + 5 files changed, 22 insertions(+) diff --git a/apps/advanced/README.md b/apps/advanced/README.md index f088fc8..a2bcdd4 100644 --- a/apps/advanced/README.md +++ b/apps/advanced/README.md @@ -84,3 +84,15 @@ assuming `yii-advanced` is directly under the document root of your Web server. ### Install from an Archive File This is not currently available. We will provide it when Yii 2 is formally released. + +GETTING STARTED +--------------- + +After template application and its dependencies are downloaded you need to initialize it and set some config values to +match your application requirements. + +1. Execute `install` command selecting `dev` as environment. +2. Set `id` value in `console/config/main.php`, `frontend/config/main.php`, `backstage/config/main.php`. +3. Create new database. It is assumed that MySQL InnoDB is used. If not, adjust `console/migrations/m130524_201442_init.php`. +4. In `common/config/params.php` set your database details in `components.db` values. + diff --git a/apps/advanced/backstage/config/main.php b/apps/advanced/backstage/config/main.php index d47904a..d3288bd 100644 --- a/apps/advanced/backstage/config/main.php +++ b/apps/advanced/backstage/config/main.php @@ -16,6 +16,7 @@ return array( 'modules' => array( ), 'components' => array( + 'db' => $params['components.db'], 'cache' => $params['components.cache'], 'user' => array( 'class' => 'yii\web\User', diff --git a/apps/advanced/common/config/params.php b/apps/advanced/common/config/params.php index 015be76..b9409f9 100644 --- a/apps/advanced/common/config/params.php +++ b/apps/advanced/common/config/params.php @@ -6,4 +6,11 @@ return array( 'components.cache' => array( 'class' => 'yii\caching\FileCache', ), + + 'components.db' => array( + 'class' => 'yii\db\Connection', + 'dsn' => 'mysql:host=localhost;dbname=yii2advanced', + 'username' => 'root', + 'password' => '', + ), ); \ No newline at end of file diff --git a/apps/advanced/console/config/main.php b/apps/advanced/console/config/main.php index a237444..83cb2e3 100644 --- a/apps/advanced/console/config/main.php +++ b/apps/advanced/console/config/main.php @@ -16,6 +16,7 @@ return array( 'modules' => array( ), 'components' => array( + 'db' => $params['components.db'], 'cache' => $params['components.cache'], 'log' => array( 'class' => 'yii\logging\Router', diff --git a/apps/advanced/frontend/config/main.php b/apps/advanced/frontend/config/main.php index e83ac26..607c9a9 100644 --- a/apps/advanced/frontend/config/main.php +++ b/apps/advanced/frontend/config/main.php @@ -16,6 +16,7 @@ return array( 'modules' => array( ), 'components' => array( + 'db' => $params['components.db'], 'cache' => $params['components.cache'], 'user' => array( 'class' => 'yii\web\User',