Skip to content

Commit

Permalink
change configuration to new array syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
nekufa committed Feb 2, 2015
1 parent b9a3672 commit 95882d3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions database.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ Sometimes you may wish to use one database connection for SELECT statements, and

To see how read / write connections should be configured, let's look at this example:

'mysql' => array(
'read' => array(
'mysql' => [
'read' => [
'host' => '192.168.1.1',
),
'write' => array(
],
'write' => [
'host' => '196.168.1.2'
),
],
'driver' => 'mysql',
'database' => 'database',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
],

Note that two keys have been added to the configuration array: `read` and `write`. Both of these keys have array values containing a single key: `host`. The rest of the database options for the `read` and `write` connections will be merged from the main `mysql` array. So, we only need to place items in the `read` and `write` arrays if we wish to override the values in the main array. So, in this case, `192.168.1.1` will be used as the "read" connection, while `192.168.1.2` will be used as the "write" connection. The database credentials, prefix, character set, and all other options in the main `mysql` array will be shared across both connections.

Expand Down

0 comments on commit 95882d3

Please sign in to comment.