I've very curious about what I'm missing. Only an example will help explain but here's the sentence question first: Inventory and InventoryCategory - both have Image associations. When I view a single InventoryCategory and the related Inventory I would like both Image associations. Currently I'm only returned the InventoryCategory->Image. No images are returned for the Inventory items. This is what I have in the models:
Inventory:
public $belongsTo =
array(
'User'
, 'InventoryCategory'
,
);
public $hasMany =
array(
'Image' => array
(
'className' => 'Media.MediaImage'
, 'foreignKey' => 'foreign_key'
, 'conditions' => array(
'Image.model' => 'Inventory'
, 'Image.group' => 'Image'
,
)
, 'dependent' => true
, 'order' => 'Image.rank ASC, Image.id ASC'
)
,
);
public function containedModels()
{
$contain = array(
'Image'
, 'User'
, 'InventoryCategory'
,
);
return $contain;
}
InventoryCategory
public $hasOne =
array(
'Image' => array
(
'className' => 'Media.MediaImage'
, 'foreignKey' => 'foreign_key'
, 'conditions' => array(
'Image.model' => 'InventoryCategory'
, 'Image.group' => 'Image'
,
)
, 'dependent' => true
,
)
,
);
public $hasMany =
array(
'Inventory'
,
);
public function containedModels()
{
$contain = array(
'Image'
, 'Inventory'
,
);
return $contain;
}