Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Gallery. Get the first Image.


3 Posts   694 Views


18 May 2010 at 9:06am (Last edited: 18 May 2010 9:10am), Community Member, 9 Posts

Hi I Use DataObjectManager Modul

And I create a realy simple Gallery, and everything works perfect, but now i want to make some kind of Holder lets say a KatalogImageHolder.php where the children are KatalogImagePage, where I want to show only the first Image of the KatalogImagePage. And I have no Idea how can I do that stuff :) (I Know this is not so really appended from DataObjectManager Modul)

Please Help me to get it work

KatalogImageHolder.php looks like this

class KatalogImageHolder extends Page {

   static $db = array(

   static $has_one = array(
   static $allowed_children = array('KatalogImagePage');

and KatalogImagePage.php like this

class KatalogImagePage extends Page
   static $has_many = array (
      'KatalogImages' => 'KatalogImage'
// Here go, I don't know how to make it run,
public function getFirstPhoto(){
         return $this->KatalogImages[0]; //that doesn't work :)


@UncleCheese. My Post has been duplicated, please delete one of them


18 May 2010 at 9:25am 4085 Posts

In the template:


In the controller:



18 May 2010 at 9:38pm Community Member, 9 Posts

Oh men, @UncleCheese :)

I knowed, I've read about this, but many , many months ago ;)

It is working now, thanks for your help