$hasMany is given an array so you need to add another item to that
array for the works assoc.
in its simplest form it would be: array('Event','Work')
This should work for you with all the possible options included.
var $hasMany = array(
'Event' => array('className' => 'Event',
'foreignKey' => 'person_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
'Work' => array('className' => 'Work',
'foreignKey' => 'person_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)
);
On Feb 14, 4:45 am, jvandal <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a person table that has an many events table and also has many
> work tables
> one person has several events and also has several works .
> I can't get the code correct.
> ==============================================================
> <?php
> class Person extends AppModel {
>
> var $name = 'Person';
> var $useTable = 'people';
>
> //The Associations below have been created with all possible keys,
> those that are not needed can be removed
>
> var $hasMany = array(
> 'Event' => array('className' => 'Event',
> 'foreignKey'
> => 'person_id',
> 'dependent'
> => false,
> 'conditions'
> => '',
> 'fields' =>
> '',
> 'order' => '',
> 'limit' => '',
> 'offset' =>
> '',
> 'exclusive'
> => '',
> 'finderQuery'
> => '',
>
> 'counterQuery' => ''
> )
> );
>
> }
>
> ?>
> This the code generated for one has many event .
> Copied this code to have two has many work but I get an error.
> What is the correct code to also have the work table associated to the
> person table?
>
> Thanks for any help
> Jim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---