I want to access the DATABASE_CONFIG class values located at app/config/database.php
inside a plugin app/Plugin/Myplugin/bootstrap.php
class DATABASE_CONFIG {
public $redis = array(
'datasource' => 'Redis.RedisSource',
'host' => '127.0.0.1',
'port' => '6379',
'db' => '2'
);
}
I want to access the $redis
host and port inside Myplugin
EDIT: THE CAKEPHP VERSION IS 2.1.2
Get the database details :-
App::uses('ConnectionManager', 'Model');
$dataSource = ConnectionManager::getDataSource('redis');
$host = $dataSource->config['host'];
$port = $dataSource->config['port'];