I am a newbie to cakephp and could really use some help and suggestions!
the application I am working with currently interacts with two databases, both databases have more or less a similar schema and table structure, I have to save some information in both databases, so i have this table say "employee_information" in both databases, both tables have a set of common fields (first_name, last_name, birthday, gender etc) and some other fields specific to that database. now i have to save some information into the other database using cakephp model::save() method, previously I was normally switching data source and would use sql INSERT to do this and it was working fine, but now i really would like using cakephp conventional methods to do this, reason is that i think i am missing a great deal by not using cake's own methods ( data sanitizing in my case) i had tried switching data source and using model::save(), the method did not work, though it did not log any errors, but also did not add any record into the database.
// using following snippet in the model to save.
$this->setDataSource('secondary_database');$this->save($this->data);$this->setDataSource('primary_database');
Any ideas or suggestions would be highly appreciated!
Thanks!
$this->useTable = 'secondary_table';book.cakephp.org/2.0/en/models/model-attributes.html#usetable. PS: you are asking for "different database table", do you want to use another "database", or another "table" within the SAME database? - Jelmer