the data modeling. Please model your data first and then create the
corresponding models.
Now, to help you on the way :)
You have a user, the user can have one of many statuses. You can model
your data as two tables or as one table with a column for the status.
If you only have a few status values, I suggest you to include the
status as a column in the user table using a smallint column named
"status".
But if you prefer to have two tables, then the relationships are as
follows:
One User belongsTo one Status
One Status hasMany User
That is all :) Hope this helps you on the way,
John
On Dec 28, 3:24 am, Brettski <brettsk...@gmail.com> wrote:
> 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:
Post a Comment