CakePHP switch database (using same datasource) on the fly?

Made it work using this (create a new connection on the fly) : $newDbConfig = $this->dbConnect($serverConfig); $this->Model->useDbConfig = $newDbConfig[‘name’]; $this->Model->cacheQueries = false; With : /** * Connects to specified database * * @param array $config Server config to use {datasource:?, database:?} * @return array db->config on success, false on failure * @access public */ function … Read more

CakePHP: best way to call an action of another controller with array as parameter?

I would not advice to use the method requestAction but rather import, and instantiate the needed controller. CakePHP doc says about requestAction that: “It is rarely appropriate to use in a controller or model” http://book.cakephp.org/view/434/requestAction Once you imported and loaded the controller you can call any method of this controller with its parameters. <?php //Import … Read more