Currently, I define my BelongsTo relations as:

  var $belongsTo = array(
        'User' => array(
            'className' => 'User',
            'foreignKey' => 'user_id'
        ),
        'Post' => array(
            'className' => 'Post',
            'foreignKey' => 'post_id'
        ),
        'Photo' => array(
            'className' => 'Photo',
            'foreignKey' => 'photo_id'
        ),
        'Video' => array(
            'className' => 'Video',
            'foreignKey' => 'video_id'
        )
  );

And then I use an additional 'type' field in my database that I will
set to either 'post', 'photo' or 'video'.

Would you have a better idea?

Cheers,

Thierry


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to