I suggest you try the "bake" feature to generate the codes to minimize
any syntax issues.
About hasMany, it has other parameters that might need to be set, and,
I think you cannot define multiple hasMany variables (just put all
related models in an array).

e.g.

class User extends AppModel {
var $name = 'User';
var $hasMany = array(
           'Article' => array('className' => 'Article',
           'foreignKey' => 'user_id',
           'dependent' => false,
           'conditions' => '',
          ... some other parameters...
          ),
          'Event' => array('className' => 'Event',
          ...other parameters...
          )
);


Note that this will be automatically generated when you use the bake
feature.


On Dec 8, 1:53 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> I'm building a basic CMS and I have a 'users' table that is related to
> more than one other table. The 'users' table is related to these other
> tables by a '$hasMany' relationship. I did the bare minimum in terms
> of setting up my models and databases using the $scaffold feature so I
> could be sure everything worked before getting in too deep. Cake set
> everything up for me nicely except for anything having to do with my
> 'users' table which is related to a bunch of other tables in a
> $hasMany relationship. I'm pretty new to PHP so I'm not sure if I just
> have a syntax problem or if PHP doesn't allow one table to have more
> than one $hasMany relationship. Here is the model code I am having
> trouble with:
>
> <?php
>
> class User extends AppModel {
>         var $name = 'User';
>         var $hasMany = array('Article');
>         var $hasMany = array('Event');
>         var $hasMany = array('Post');
>         var $hasMany = array('Price');
>         var $hasMany = array('Upload');
>
> }
>
> ?>
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to