Matt, thanks so much for all the time you took to test this thing. I can see how it could work now. I'm off and running now.
Thanks!!! On Mon, Apr 09, 2007 at 07:59:26PM -0000, BlenderStyle wrote: > > Okay, I just tried it, and it worked. Here's what I did: > > Downloaded cake_1.2.0.4798alpha, extracted it, and made app/tmp > writeable. > I created the following databases/users/tables: > > database: multidbtest_a > user: multidbtest_a > table: users (id, name) > > database: multidbtest_b > user:multidbtest_b > table: profiles (id, user_id, name) > > I setup app/config/database.php as follows: > var $default = array( > 'driver' => 'mysql', > 'persistent' => false, > 'host' => 'localhost', > 'login' => 'multidbtest_a', > 'password' => 'NNJdALDhvm6Uqm8,', > 'database' => 'multidbtest_a', > 'prefix' => '' > ); > > var $dbb = array( > 'driver' => 'mysql', > 'persistent' => false, > 'host' => 'localhost', > 'login' => 'multidbtest_b', > 'password' => ':.bwaJ6wXCDQs8Q:', > 'database' => 'multidbtest_b', > 'prefix' => '' > ); > > I created two models with two controllers. The first model is User: > class User extends AppModel > { > var $name = 'User'; > var $useDbConfig = 'default'; > var $useTable = 'users'; > > var $hasOne = array( > 'Profile' => array( > 'className' => 'Profile', > 'foreignKey' => 'user_id' > ) > ); > } > > The other model is Profile: > class Profile extends AppModel > { > var $name = 'Profile'; > var $useDbConfig = 'dbb'; > var $useTable = 'profiles'; > > var $belongsTo = array( > 'User' => array( > 'className' => 'User', > 'foreignKey' => 'user_id' > ) > ); > } > > Then, my two controllers: > class UsersController extends AppController > { > var $name = 'users'; > var $scaffold; > } > > class ProfilesController extends AppController > { > var $name = 'profiles'; > var $scaffold; > } > > > I browsed to somesite.com/users and created a couple of users, then > went over to somesite.com/profiles and created some profiles for those > users. That's it. Took about 5 minutes to get this up and running. The > real key to making this work is the persistent key (ha! a pun) in the > database configs. I think 1.2 defaults to persistent false, where 1.1 > doesn't. > > Matt Bowden > > On Apr 9, 10:10 am, Sergei Gerasenko <[EMAIL PROTECTED]> > wrote: > > > Yes, that should work. I haven't tried it, and I don't know how Cake > > > queries in a situation like this, but it doesn't hurt to try. Try it > > > out with scaffolding, and see if it works. Let us know. > > > > I think it would definitely stop working if database "B" has another > > username/password combination. This whole issue could throw a big wrench > > into > > the gears. But I'll try tonight anyway and will let you know. > > > > -- Sergei Gerasenko IT Department PublicSchoolWORKS Phone: (513)-631-6111 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---