What you're after is a belongsTo relationship.

Purchase:
$belongsTo = array('Currency'=>array('className'='currency',foreignKey
= 'currency_id'));

Simon
http://www.simonellistonball.com/

On Apr 4, 7:57 am, yitzc <[EMAIL PROTECTED]> wrote:
> Hi,
> I am trying to make a relation between a purchase and a currency -
> that is, each purchase is a certain amount and is paid in a certain
> currency (dollars or pounds). I am doing this so that I will be able
> to add other currencies later.
> What I want to do is for the customer to be able to choose from a drop-
> down box which currency he will be paying in.
>
> Currently I am using a Purchase hasOne Currency - But for some reason
> it's when I do a findAll() to Purchases it says SQL Error: 1054:
> Unknown column 'Currency.purchase_id' in 'field list'. (There is a
> 'currency_id' field in the purchase table, but there is NOT a
> purchase_id field on the currency table, because I don't want a
> currency to be tied down to a certain purchase - hence the error).
>
> Now I know I could fix this with a HABTM relation, but I don't want
> the currency to haveMany Purchases - I don't need the extra overhead
> and table. Is there any belongsToMany relation?
>
> (And after I figure that out how do I map the currency name on the
> Purchase view to the currency_id field?)
>
> Thank you,
> yitzcv
--~--~---------~--~----~------------~-------~--~----~
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