Re: Dynamic Selection of Database config based on Debug level

2009-10-25 Thread Dr. Loboto

Wrong parent call:

function __construct($id = false, $table = null, $ds = null)
{
if($_SERVER['HTTP_HOST'] == 'xxx' || $_SERVER
['HTTP_HOST'] ==
'www.xxx'){
$this-useDbConfig='production';
}
parent::__construct($id, $table, $ds);
}

And, just for sure, is your app_model.php located at /app/
app_model.php?

On Oct 24, 5:07 pm, CapeTownGuy cobus.van.aa...@gmail.com wrote:
 I added the following into my AppModel:

 function __construct($id = false, $table = null, $ds = null)
         {
                 if($_SERVER['HTTP_HOST'] == 'xxx' || $_SERVER['HTTP_HOST'] ==
 'www.xxx'){
                                 $this-useDbConfig='production';
                         }
                 parent::__construct($id = false, $table = null, $ds = null);
         }

 However, when the app runs, the following error is returned:

 Missing Database Table
 Error: Database table app_models for model AppModel was not found.
 Notice: If you want to customize this error message, create app\views
 \errors\missing_table.ctp

 Please can you point me again in the right direction?

 On Sep 10, 7:21 am, Dr. Loboto drlob...@gmail.com wrote:



  Have both configs in database.php, add AppModel, in it's constructor
  set appropriate db config name to $this-useDbConfig and then call
  parent constructor. Copy constructor arguments for AppModel from Model
  and don't forget to pass them all to parent::__constructor();

  On Sep 9, 3:21 pm, CapeTownGuy cobus.van.aa...@gmail.com wrote:

   Hi, is there some instructions on how to get Cake to use an
   alternative Database config, based on the Debug level, I currently use
   the following code inside my core.php to dynamically change between
   debug levels, based on whether I'm on my localhost, or on my
   production server... I tried the same technique inside database.php,
   but it doesn't seem to work.

   if($_SERVER['HTTP_HOST'] == 'xxx.com' || $_SERVER['HTTP_HOST'] ==
   'www.xxx.com'){
                   Configure::write('debug', 0);
           }else{
                   Configure::write('debug', 2);
           }
--~--~-~--~~~---~--~~
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: Dynamic Selection of Database config based on Debug level

2009-10-24 Thread CapeTownGuy

I added the following into my AppModel:

function __construct($id = false, $table = null, $ds = null)
{
if($_SERVER['HTTP_HOST'] == 'xxx' || $_SERVER['HTTP_HOST'] ==
'www.xxx'){
$this-useDbConfig='production';
}
parent::__construct($id = false, $table = null, $ds = null);
}


However, when the app runs, the following error is returned:


Missing Database Table
Error: Database table app_models for model AppModel was not found.
Notice: If you want to customize this error message, create app\views
\errors\missing_table.ctp

Please can you point me again in the right direction?


On Sep 10, 7:21 am, Dr. Loboto drlob...@gmail.com wrote:
 Have both configs in database.php, add AppModel, in it's constructor
 set appropriate db config name to $this-useDbConfig and then call
 parent constructor. Copy constructor arguments for AppModel from Model
 and don't forget to pass them all to parent::__constructor();

 On Sep 9, 3:21 pm, CapeTownGuy cobus.van.aa...@gmail.com wrote:

  Hi, is there some instructions on how to get Cake to use an
  alternative Database config, based on the Debug level, I currently use
  the following code inside my core.php to dynamically change between
  debug levels, based on whether I'm on my localhost, or on my
  production server... I tried the same technique inside database.php,
  but it doesn't seem to work.

  if($_SERVER['HTTP_HOST'] == 'xxx.com' || $_SERVER['HTTP_HOST'] ==
  'www.xxx.com'){
                  Configure::write('debug', 0);
          }else{
                  Configure::write('debug', 2);
          }
--~--~-~--~~~---~--~~
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: Dynamic Selection of Database config based on Debug level

2009-10-24 Thread Jon Bennett

Hi

 Please can you point me again in the right direction?

I have host name switch in 3 places:

* webroot/index.php - to optionally change the location of the cake
libs, http://pastie.org/667873
* config/bootstrap.php - to override core settings such as debug
level, caching on/off etc, http://pastie.org/667875
* config/database.php - I create the class within the switch
statement, so only have the $default connection defined,
http://pastie.org/667872

hth

jon

-- 
jon bennett - www.jben.net - blog.jben.net

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Dynamic Selection of Database config based on Debug level

2009-09-09 Thread CapeTownGuy

Hi, is there some instructions on how to get Cake to use an
alternative Database config, based on the Debug level, I currently use
the following code inside my core.php to dynamically change between
debug levels, based on whether I'm on my localhost, or on my
production server... I tried the same technique inside database.php,
but it doesn't seem to work.

if($_SERVER['HTTP_HOST'] == 'xxx.com' || $_SERVER['HTTP_HOST'] ==
'www.xxx.com'){
Configure::write('debug', 0);
}else{
Configure::write('debug', 2);
}
--~--~-~--~~~---~--~~
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: Dynamic Selection of Database config based on Debug level

2009-09-09 Thread Dr. Loboto

Have both configs in database.php, add AppModel, in it's constructor
set appropriate db config name to $this-useDbConfig and then call
parent constructor. Copy constructor arguments for AppModel from Model
and don't forget to pass them all to parent::__constructor();

On Sep 9, 3:21 pm, CapeTownGuy cobus.van.aa...@gmail.com wrote:
 Hi, is there some instructions on how to get Cake to use an
 alternative Database config, based on the Debug level, I currently use
 the following code inside my core.php to dynamically change between
 debug levels, based on whether I'm on my localhost, or on my
 production server... I tried the same technique inside database.php,
 but it doesn't seem to work.

 if($_SERVER['HTTP_HOST'] == 'xxx.com' || $_SERVER['HTTP_HOST'] ==
 'www.xxx.com'){
                 Configure::write('debug', 0);
         }else{
                 Configure::write('debug', 2);
         }
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---