Dear all
Has anybody here successfully created a database config and model
dynamically using the latest cake 1.2? I want to create something not
a million miles away from phpmyadmin, and as you can imagine, for an
app like that, you cant pre-set the database or models before hand as
you know
Your best bet here is to create new config members in the
DATABASE_CONFIG class, you can then use DataSource:reconnect to swap
your alt config for the others you've just created. Your models would
then useDbConfig alt, which would actually no longer be alt, but
whichever config you reconnected
Thanks for that, I've got slightly further along which i'm very very
happy about. I still need to find a way of discovering what any
particular table's primarykey is, otherwise my paginator will keep
trying to find a field called ID.
Many thanks
MIke
On 06/09/07, [EMAIL PROTECTED]
[EMAIL
I would take a look at Model::loadInfo() if I were you, also
Model::primaryKey
Hope they help!
Simon
On Sep 6, 11:44 am, Mike Green [EMAIL PROTECTED] wrote:
Thanks for that, I've got slightly further along which i'm very very
happy about. I still need to find a way of discovering what any
Thanks for your help
it is now working perfectly. I've added a small helper function into
the model to make things a lot easier:
function setSource($tableName) {
$this-setDataSource($this-useDbConfig);
$db = ConnectionManager::getDataSource($this-useDbConfig);