I ran into this too. One of the database configs has to be default. So
change $psw to $default, and remove var $useConfig in your customer
model (it uses default by, well, default).
If persistent is set to true, you can't use two configs
simultaneously. I'm guessing if persistent is true, and the default
database config (host, username, password, database) is used, it keeps
that connection open. Then, when your other model comes into play it
will try to use the same connection.
On Apr 9, 4:15 pm, Sergei Gerasenko <[EMAIL PROTECTED]>
wrote:
> > You're welcome. In doing this, I learned about the persistent key, so
> > everyone wins. Let us know how it goes.
>
> Just tried this at home and I'm baffled with this error: Cannot redeclare
> class dbosource in /var/www/cake/cake/libs/model/datasources/dbo_source.php
>
> Here's my setup:
>
> app/config/database.php:
> =======================
>
> var $psw = array('driver' => 'mysql',
> 'connect' => 'mysql_connect',
> 'host' => 'localhost',
> 'login' => '***',
> 'password' => '***',
> 'database' => 'psw',
> 'persistent' => false,
> 'prefix' => '');
>
> var $pbs = array('driver' => 'mysql',
> 'connect' => 'mysql_connect',
> 'host' => 'localhost',
> 'login' => '***',
> 'password' => '***',
> 'database' => 'pbs',
> 'persistent' => false,
> 'prefix' => '');
>
> app/models/student.php
> =======================
> <?
> class Student extends AppModel
> {
> var $name = 'Student';
> var $useDbConfig = 'pbs';
>
> var $belongsTo = array(
> 'Customer' => array('className' => 'Customer')
> );}
>
> ?>
>
> app/models/customer.php
> =======================
> <?
> class Customer extends AppModel
> {
> var $name = 'Customer';
> var $useDbConfig = 'psw';}
>
> ?>
>
> Am I missing something?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---