You forgot the "array" part:
var $hasOne = array('Type');
BUT you probably want:
var $belongsTo = array('Type');
Type:
var $hasMany = array('User');
If you used Group instead of Type it would make more sense.
On Mon, Aug 17, 2009 at 12:52 PM, Magua<[email protected]> wrote:
>
> Please note I am a very GREEN newby to MVC programing.
>
> I have 2 tables.
> 1.> users
> Fields: id, user, type_id
> 2.> types
> Fields: id, type
>
> Each user can have only 1 "type" and each "type" can have many
> "users".
> I have created the following models.
>
> user.php
> <?
> class User extends AppModel {
> var $name = 'User';
> var $hasOne = 'Type';
> }
> ?>
> The above model generates this error.
> Parse error: syntax error, unexpected '(' in /var/www/beta/htdocs/app/
> models/kind.php on line 4
>
>
> type.php
> <?
> class type extends AppModel {
> var $name = 'type';
> var $hasMany = ('user');
> }
> ?>
> The type error generates this error.
> Parse error: syntax error, unexpected '(' in /var/www/beta/htdocs/app/
> models/type.php on line 4
>
>
> What am i doing wrong? Is this not a hasOne Relationship.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---