I have a gridfield in SectionPage managing a has_many dataobject 'Sections' => 'Section', which in turn has_many 'Gallery' => 'GalleryItem' which has_one image.
How can I get the Gridfield to return a thumbnail of the first GalleryItem?
I have tried many variations in Section.php, but feel this is the closest I have got:
public function getThumbnail() {
return $this->Gallery()->First()->Photo()->CMSThumbnail();
}
This gives me a 'Call to a member function Photo() on a non-object in...' error.
Can anyone give me some help with this problem?