I think all you will need is to first verify that your User model can
access users and your Product model can access products from their
respective databases. Then create your association between the two as
normal. The difference is that you should set the 'external'
attribute to true in the association.
i.e.:
var $hasMany =
array('Product'=>array('className'=>'Product','external'=>true,'foreign_key'=>'user_id');
HTH,
David Lloyd
--
lloydhome consulting, inc.
http://www.lloydhome.com
On Feb 5, 10:05 am, "lukemack" <[EMAIL PROTECTED]> wrote:
> hi,
>
> i'm going to need to access some legacy data from another system in my
> cake app. i understand that i can add an additional database
> connection in the database config file and have the model use that
> connection. however, if i then need the data in a legacy database
> (e.g. product data) to relate to models in the main cake app database,
> how is this best achieved?
>
> an example: I have a users table and a reviews table in my cake app in
> the 'cakeApp' database. I need to associate a product review with a
> user. Product data is stored in the products table in the 'legacyData'
> database. how do i associate my user and review models with the legacy
> product data? the legacy data is not aware of cakePHP and therefore
> doesn't have foreign keys etc. configured correctly.
>
> any thoughts gratefully received. would it, for example, be a good
> idea to create a view of the legacy data (the database kind of view)
> in the cakeApp database? is that even possible in mySQL?
>
> many thanks,
>
> lukemack.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---