Skip to content

Instantly share code, notes, and snippets.

@mariuswilms
Created February 1, 2009 15:57
Show Gist options
  • Save mariuswilms/55889 to your computer and use it in GitHub Desktop.
Save mariuswilms/55889 to your computer and use it in GitHub Desktop.
<?php
class Movie extends AppModel {
// ...
var $hasMany = array(
'Poster' => array(
'className' => 'Media.Attachment',
'foreignKey' => 'foreign_key',
'conditions' => array('Poster.model' => 'Movie', 'Poster.group' => 'poster'),
'dependent' => true,
),
'Photo' => array(
'className' => 'Media.Attachment',
'foreignKey' => 'foreign_key',
'conditions' => array('Photo.model' => 'Movie', 'Photo.group' => 'photo'),
'dependent' => true,
),
'Trailer' => array(
'className' => 'Media.Attachment',
'foreignKey' => 'foreign_key',
'conditions' => array('Trailer.model' => 'Movie', 'Trailer.group' => 'trailer'),
'dependent' => true,
));
// ...
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment