I am trying to get data from two different databases in the controller
application /Controller/UsersController.php
my db connections are declared in database.php
$default = array(
...
'database' => 'test'
...
);
$test = array(
...
'database' => 'test1'
...
);
and in action display():
public function display() {
$this->set('defaultUsers', $this->User->find('all'));
$this->User->schemaName = 'test1';
$this->User->cacheQueries = false;
$this->set('testUsers', $this->User->find('all'));
}
This would allow me to get data from two different sources, however, the problem is that these two databases must have the same password, otherwise it will not work.
I tried other solutions found here and on other sites. as:
change $this->User->useDbConfig = 'test'and $this->User->cacheQueries = falsestill give me the same dataset;
Using ConnectionManager::getDataSource()and setConfig(), create(), drop(), setDataSource(), etc. None of them work, and some do not even exist anymore.
!
a.k.a .
!