Hi,
I was trying to setup a relationship between User and Group through
cake console. But I need help since there are strange things going on.
In my users table, I have these fields:
- id
- username
- password
- group_id
And, in my groups table, I have these fields:
- id
- name
I would like to have a one-to-many relationships between users and
groups. Meaning that Groups can have many users, and one user can
belong to only one group
When I tried to build User Model through cake console, here's what I
got:
Welcome to CakePHP v1.2.0.7296 RC2 Console
---------------------------------------------------------------
App : taxmate
Path: /Users/rezmuh/Sites/taxmate
---------------------------------------------------------------
Interactive Bake Shell
---------------------------------------------------------------
[D]atabase Configuration
[M]odel
[V]iew
[C]ontroller
[P]roject
[Q]uit
What would you like to Bake? (D/M/V/C/P/Q)
> M
---------------------------------------------------------------
Bake Model
Path: /Users/rezmuh/Sites/taxmate/models/
---------------------------------------------------------------
Possible Models based on your current database:
1. Group
2. User
Enter a number from the list above, type in the name of another model,
or 'q' to exit
[q] > 2
Would you like to supply validation criteria for the fields in your
model? (y/n)
[y] > n
Would you like to define model associations (hasMany, hasOne,
belongsTo, etc.)? (y/n)
[y] > y
One moment while the associations are detected.
---------------------------------------------------------------
None found.
Would you like to define some additional model associations? (y/n)
[n] > n
A similar weird message of "None found" shows up when I tried build
Group Model.
Is this expected? Doesn't CakePHP allow me to have this type of
relationship by default? Or would it work if I wrote var $hasMany =
array(...) in Group Model and var $belongsTo = array(...) in User
Model by hand?
Thank you for your help :)
-Reza
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---