Question

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

Était-ce utile?

La solution

I found the way:

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top