In my app/Config/database.php
I have a setup which looks like this,
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'root',
'password' => '',
'database' => 'default_db',
'prefix' => '',
//'encoding' => 'utf8',
);
public $second = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'root',
'password' => '',
'database' => 'second_db',
'prefix' => '',
//'encoding' => 'utf8',
);
Now what I wanted was to simultaneously save the data, wherever and whenever I am saving any kind of data. This databases are identical, that is why I want to save the data to both databases to maintain them being identical. Where would I edit such that all the save/edit/update/delete
processes will both save to both databases. Thank you in advance.
EDIT
in my lib/Cake/Model/Model.php
is a line of code which looks like this
/**
* The name of the DataSource connection that this Model uses
*
* The value must be an attribute name that you defined in `app/Config/database.php`
* or created using `ConnectionManager::create()`.
*
* @var string
* @link http://book.cakephp.org/2.0/en/models/model-attributes.html#usedbconfig
*/
public $useDbConfig = 'default';
is there where I should start editing to be able to save the data into two databases? Thanks.