I have a CatalogItem DataObject that has_many VinylSlots and VinylSlot DataObject has_many Thumbnails.
class CatalogItem extends DataObject {
static $has_many = array(
'VinylSlots' => 'VinylSlot'
)
}
class VinylSlot extends DataObject {
static $has_many = array(
'Thumbnails' => 'VinylSlotPhoto'
)
}
I have a Page on which I would like to loop through a filtered set of CatalogItems and get the VinylSlots' Thumbnails.
Here is what I have that is not working:
class SCBPage_Controller extends Page_Controller {
public function getReleases() {
$releases = DataObject::get('CatalogItem', 'ShoolChoirRelease = 1');
$covers = new DataObjectSet();
foreach($releases as $release) {
$covers->push(new ArrayData(
array(
'Vinyl' => new DataObjectSet($release->VinylSlots())
)
));
}
return $covers;
}
}
And in the template:
<% control Releases %>
<% control Vinyl %>
$Thumbnails
<% end_control %>
<% end_control %>
Any thoughts on how I can pull the urls of the VinylSlots Thumbnails using a function in the SCB Controller?
Thanks.