CakePHP does make somethings really easy, and sometimes, not so easy. I like to have a testing setting and a production setting stored in my databases.php. Your DATABASE_CONFIG object of course contains those arrays of settings. So the question is, how do you switch exactly?
It is never mentioned specifically in the documentation, but you can do it by using the AppModel class.
class AppModel extends Model {
public $useDbConfig = "testing";
// public $useDbConfig = "production";
}
What’s great about this setup is that, while on your testing server, it works with your local database. You can then upload this along with the rest of your CakePHP application. Once on your remote server, either via SSH and VIM or simply an FTP file-edit, you can comment out $useDbConfig = "testing" and uncomment public $useDbConfig = "production".
This is super-model is extended by every model you use in your application. That way, every single model will also use those database settings. This is an incredibly easy way to manage different server environments.