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 nothing about the data source.

Ideally, I'd like to read a database config file (from anywhere, an
ini file, fields from a database, input from a user) and then be able
to create the dbconfig on the fly - which I can do using something
like:

$_this =& ConnectionManager::getInstance();
$_this->config->alt['password']=$info['db_pass'];
$_this->config->alt['login']=$info['db_user'];
$_this->config->alt['database']=$info['db_name'];
$_this->config->alt['host']=$info['db_host'];


where alt is just a dummy dbconfig that I can populate.

then set up a model, and tell the model to use the newly created (or
altered) configuration. However, my attempts at this have failed, the
model always expects a database and table to be present, but when I
try to change this on the fly using

$this->Dummy->useTable = $info['from'];
$this->Dummy->useDbConfig="alt";

However, when I try to use this "Dummy" Model through cakes paginator,
it still tries to see the fields from whatever Dummy Model was set to
when it was loaded.

I hope one of you can see the predicament that I'm in. I'm looking for
a solution which only uses the cakephp1.2 (svn) functions - I wouldnt
be happy using any third party pagination, however using the
pagination class from the bakery in my cake 1.1 was working to an
extent.

I guess the best way to describe what I'm trying to achieve is if you
were trying to recreate phpmyadmin using cake1.2, with its results
pagination, dynamic database, custom queries etc, but on a lot smaller
scale, to be able to generate reports based on a database on the fly
(nothing hard coded)

Many thanks in advance

MIke





-- 
------------------------------------
Mike Green

Find yourself some misspelled ebay bargains!
http://www.typingwand.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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