I do it in my /config/databases.php file.
so in the class definition I have a constructor (all my stuff is php4
so I do it this way)
function DATABASE_CONFIG () {
if ($_SERVER['SERVER_NAME'] == 'dns.of.demo.machine') {
$this->default = $this->dev;
}
}
Though I think that using the __constructor() that cake uses
everywhere else for php4 and 5 uniformity should work as well.
Sam D
On 7/22/06, Ixulai <[EMAIL PROTECTED]> wrote:
>
> Ok, the app I'm developing requires a way to dynamically create &
> switch database configs at runtime. At present I am using a hack to
> create new datasources at runtime. (SVN copy has
> ConnectionManager::create for this purpose but for some reason
> 1.1.6.3264 doesn't have this, despite it being added in 3195? Relevant
> ticket to show the method I'm using;
> https://trac.cakephp.org/ticket/1068 )
>
> To switch database configs I am altering useDbConfig in my instantiated
> models. However, I have recently been informed by nate that useDbConfig
> was never meant to be modifed at runtime. (
> https://trac.cakephp.org/ticket/1184 )
>
> Does anyone know if there is a 'correct' procedure for switching to a
> database config that can only be determined at runtime?
>
> I guess it's not a big issue for most, but if there isn't a correct
> procedure then perhaps there should be? Now that at least the SVN copy
> of ConnectionManager is capable of creating dynamic connections and
> all.
>
> Thanks for any help :-)
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---