Re: changing $useDbConfig 'on-the-fly' ?

2013-08-24 Thread Simon Males
Database.php

On Friday, August 23, 2013, Albert Maristany Borge wrote:

> Excuse me, it's a log time after, but I need help please.
>
> Where should I put this function? In the model, in the appmodel, in the
> controler?
> And how do I call the function? From where do I call it?
>
> Many thanks in advance!
>
> El lunes, 16 de marzo de 2009 15:09:03 UTC+1, Martin Westin escribió:
>>
>>
>> This is for only a single model?
>> In that case you can put the if-clause in the constructor.
>>
>> function __construct($id = false, $table = null, $ds = null) {
>>
>> if ( should use special config ) {
>> $this->useDbConfig = 'special_config';
>> }
>> parent::__construct($id, $table, $ds);
>> }
>>
>>
>>
>>
>> On Mar 16, 9:27 am, K3  wrote:
>> > how can i switch useDbConfig 'on-the-fly' ? it should depend of an URL
>> > param. I cannot put 'if' statetment in the variable declaration
>> > section... pls help
>> >
>> > Thanks
>
>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com  'cake-php%2bunsubscr...@googlegroups.com');>.
> To post to this group, send email to 
> cake-php@googlegroups.com 'cake-php@googlegroups.com');>
> .
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/groups/opt_out.
>


-- 
Simon Males

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: changing $useDbConfig 'on-the-fly' ?

2013-08-24 Thread Albert Maristany Borge
Excuse me, it's a log time after, but I need help please.

Where should I put this function? In the model, in the appmodel, in the 
controler?
And how do I call the function? From where do I call it?

Many thanks in advance!

El lunes, 16 de marzo de 2009 15:09:03 UTC+1, Martin Westin escribió:
>
>
> This is for only a single model? 
> In that case you can put the if-clause in the constructor. 
>
> function __construct($id = false, $table = null, $ds = null) { 
>
> if ( should use special config ) { 
> $this->useDbConfig = 'special_config'; 
> } 
> parent::__construct($id, $table, $ds); 
> } 
>
>
>
>
> On Mar 16, 9:27 am, K3  wrote: 
> > how can i switch useDbConfig 'on-the-fly' ? it should depend of an URL 
> > param. I cannot put 'if' statetment in the variable declaration 
> > section... pls help 
> > 
> > Thanks

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: changing $useDbConfig 'on-the-fly' ?

2009-03-17 Thread Smelly Eddie

Gwoo's response is just what you need to set the dbconfig from a
controller based on params.  If you just mean based on the URL (dev vs
prod) then I would like to add the following resource.

http://edwardawebb.com/programming/php-programming/cakephp/automatically-choose-database-connections-cakephp

On Mar 16, 6:25 pm, Gwoo  wrote:
> http://api.cakephp.org/class/model#method-ModelsetDataSource
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: changing $useDbConfig 'on-the-fly' ?

2009-03-16 Thread Gwoo

http://api.cakephp.org/class/model#method-ModelsetDataSource
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: changing $useDbConfig 'on-the-fly' ?

2009-03-16 Thread Martin Westin


This is for only a single model?
In that case you can put the if-clause in the constructor.

function __construct($id = false, $table = null, $ds = null) {

if ( should use special config ) {
$this->useDbConfig = 'special_config';
}
parent::__construct($id, $table, $ds);
}




On Mar 16, 9:27 am, K3  wrote:
> how can i switch useDbConfig 'on-the-fly' ? it should depend of an URL
> param. I cannot put 'if' statetment in the variable declaration
> section... pls help
>
> Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---