what should I set as the default "useDbConfig" in my model?

Say I have a model called "x". This model is located in database which
I dont know the name of when loading the model uses "uses"

I first know the database name after I query the first name where I
get the name of the database.

So should I create a dummy database config? or set it to something
like false?

On Feb 13, 11:08 pm, LunarDraco <[email protected]> wrote:
> There is a property which is part of model called $useDbConfig.
> From a controller you can call or set it like:
> $this->model->setSource('mydbConfig');
> To get the current model dbConfig call
> currentconfig = $this->model->getDataSource();
>
> If your storing your config info in database1. you would build up your
> default config to point at this database.
> in your appcontroller or your appmodel you make use of your dbconfig
> model and query for the specific model.
>
> I suppose your dbconfig schema would have fields that match up to the
> database.php config array
> array(
> 'driver' => 'mysql',
> 'persistent' => false,
> 'host' => SANDBOX_DB_HOST,
> 'port' => '',
> 'login' => SANDBOX_DB_USERNAME,
> 'password' => SANDBOX_DB_PASSWORD,
> 'database' => SANDBOX_DB_NAME,
> 'schema' => '',
> 'prefix' => '',
> 'encoding' => ''
> );
> With some additional fields based on how you want to find the
> dbconfig. Based on your request I'd say at least Model.
> your query would do a findbymodel to retreive the info.
> You would then need to replace the assigned var $customdb in the
> DATABASE_CONFIG class.
> once you've done that you can set or assign the configuration to each
> model.
>
> One question what is the reason for storing the connection info in a
> database?
> if you only have a few connections you could easily add multiple
> config arrays to the database_config in app\config\database.php and
> just switch them out using the $this->model->setSource
> ('config_var_name');
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to