문제

How can I get the database name or url used in my models in php activerecord?

I have

$connections = array(
   'conn1' => 'mysql://user:pass1@localhost/db1;charset=utf8',
   'conn2' => 'mysql://user:pass2@localhost/db2;charset=utf8',
   'conn3' => 'mysql://user:pass3@localhost/db3;charset=utf8'
 );

I need to know what database are using my models, so I want to get from some object method the strings conn1 or mysql://user:pass1@localhost/db1;charset=utf8

도움이 되었습니까?

해결책

I found the way:

ActiveRecord\Config::instance()->get_default_connection_string()

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top