[Solar-talk] Connecting to two databases

Kilbride, James P. James.Kilbride at gd-ais.com
Tue Apr 1 12:50:59 CDT 2008


Antti, can you provide an example showing this? Easy to say, better to
see a code example.

James Kilbride 

-----Original Message-----
From: solar-talk-bounces at lists.solarphp.com
[mailto:solar-talk-bounces at lists.solarphp.com] On Behalf Of Antti
Holvikari
Sent: Tuesday, April 01, 2008 1:34 PM
To: solar-talk at lists.solarphp.com
Subject: Re: [Solar-talk] Connecting to two databases

On Tue, Apr 1, 2008 at 8:13 PM, Rapoport, Aaron
<Aaron.Rapoport at gd-ais.com> wrote:
>
> Hi,
>
> im using SOLAR in a php script that connects to two databases.  SOLAR 
> seems to specifically reference a class named sql in the registry from

> the Model, so ive declared the following for one database connection.
>
> if (Solar_Registry::exists('sql') == false) {
>     Solar_Registry::set('sql', 'Solar_Sql', $config); }
>
> how would i set up for the second connection?  If this has been 
> covered in a previous thread, would appreciate any references.

All the Solar classes that use Solar_Sql accept a config param for a
Solar_Sql "dependency". So, if you create a second Solar_Sql instance
and put it in the registry with a different name, say `sql2`, you can
then have classes use that other connection if you give them `sql2` as
the config param for the dependency.

Hope that helps.


--
Antti Holvikari <http://anttih.com>
_______________________________________________
Solar-talk mailing list
Solar-talk at lists.solarphp.com
http://mailman-mail3.webfaction.com/listinfo/solar-talk



More information about the Solar-talk mailing list