I want to set the database config from CakePhP 2.x with data from database


Example - database.config:


public $bd_test = array (
        'datasource' => 'Database/Postgres',
        'persistent' => false,
        'host' => 'localhost',
        'login' => 'root',
        'password' => 'root',
        'database' => 'bd_test',
        'port' => '5432',
        //'encoding' => 'UTF-8');

Should looks like:


(I Know That I Cant Do THIS, It's Just To Have an Idea)

$dataFromDb = $this->Model->find('all', array('fields' => array('host', 
'login', 'password', 'database', 'port'), 'conditions' => array('database' 
=> 'bd_test')));


public $bd_test = array (
        'datasource' => 'Database/Postgres',
        'persistent' => false,
        'host' => $dataFromDb['host'],
        'login' => $dataFromDb['login'],
        'password' => $dataFromDb['password'],
        'database' => $dataFromDb['database'],
        'port' => '5432',
        //'encoding' => 'UTF-8');

Something like that.. I guess that the Idea is clear, right? If need some 
more information, please tell me. Thanks.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to