Hi all !

My (unfortunate) Situation :

I have a Model X in one Database D1, and a Model Y in a Database D2, a
HABTM
relationship between them like outlined below, and the jointable x_y
is in D2.

class X extends AppModel
{
  public $name = "X";
  public $useTable = 'xtable';
  public $useDbConfig = 'D1';
  public $primaryKey = 'id';
  public $hasAndBelongsToMany =
        array("Y" =>
                array(
                  'joinTable'    => 'x_y',
                  'foreignKey'   => 'x_id',
                  'associationForeignKey'=> 'y_id'
                )
    );
}

class Y extends AppModel
{
  public $name = "Y";
  public $useTable = 'ytable';
  public $useDbConfig = 'D2';
  public $primaryKey = 'id';
  public $hasAndBelongsToMany =
        array("X" =>
                array(
                  'joinTable'    => 'x_y',
                  'foreignKey'   => 'y_id',
                  'associationForeignKey'=> 'x_id'
                )
    );
}

This setup works wonderful when inserting, but when trying to retrieve
data, i get
a "1146: table 'D1.x_y' doesn't exist" from (the) MySQL(i) (module).

Seems like it searches the join table in the model's dbconfig...

I tried setting "persistent" => false in the db-config, as suggested
in one
of the postings I read here, fixed a small bug in dbo_mysqli (trac
#2248), but still
cake does not use the correct db. I'm at a loss here.

Any suggestions would be very helpful ! =)

Cheers, ray


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

Reply via email to