[Solar-talk] Connecting to two databases
Rodrigo Moraes
rodrigo.moraes at gmail.com
Tue Apr 1 15:28:35 CDT 2008
On Tue, Apr 1, 2008 at 3:17 PM, Antti Holvikari wrote:
> $config['Solar_Auth_Adapter_Sql']['sql'] = 'sql2';
>
> This would create a registry entry for the other connection
> automatically when Solar starts up.
For models, it is the same as for Auth adapters: define the 'sql'
config key as 'sql2' in config, when instantiating or in the model
itself. It will use the second connection.
$model = Solar::factory('My_model', array('sql' => 'sql2'));
There's a small problem that may affect those working with 2 or more
connections. A quick solution is here:
http://solarphp.com/trac/ticket/110
Not the best one, though, as Paul pointed later. Better would be to to
set the cache key on construction, without requiring a call to
connect().
-- rodrigo
More information about the Solar-talk
mailing list