Sunday, December 27, 2009

How to setup relationships in model User has a Status

Hi,

Just learning CakePHP now.

I have a simple question, hopefully its a simple answer :)

I'm trying to get my models setup right, so I have a user model, and a
status model, for example..

Status = "Active" or "Cancelled" etc.

I can't seem to get the associations right.

How do you set each of these up so that I return an array of status's
to the user model.

I thought it would be User hasOne Status, Status hasMany Users but
that doesn't work, it looks for a Status.user_id which isn't a field
(as it doesn't make sense).

b

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: