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

$many_many DataObjects no longer displayed

Go to End

12 Posts   2274 Views


3 May 2011 at 3:09am Community Member, 65 Posts

I have a class

class Brochure extends File{

   static $db = array (
      'Title' => 'Text',
      'Name_de' => 'Text',
      'Name_en' => 'Text',
      "ShowInSearch" => "Boolean"

   static $belongs_many_many = array(
      'Pages' => 'Page'
   static $singular_name = 'Brochure';
   static $plural_name = 'Brochures';
   static $defaults = array (
         'ShowInSearch' => 0
   public function getCMSFields_forPopup()
      $filefield = new FileUploadField('Parent','PDF');
      $filefield->uploadFolder = 'brochures/';
      return new FieldSet(
         new TextField('Name_de'),
         new TextField('Name_en'),


and a PageType that has a many_many relation to the brochures

class ReferencePage extends Page {

static $many_many = array (

      'Brochures' => 'Brochure',

function getCMSFields() {
$fields = parent::getCMSFields();


// Adding Brochures      
          $brochurefilemanager = new ManyManyFileDataObjectManager(
            $this, // Controller
            'Brochures', // Source name
            'Brochure', // Source class
            'Parent', // File name on DataObject
               'Name' => 'Name'
               ), // Headings
            'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
            // Filter clause
            // Sort clause
            // Join clause
            $brochurefilemanager->default_view = 'list';
            $brochurefilemanager->allowUploadFolderSelection = false;



But these DataObjects are no longer displayed within the backend or the frontend. I looked for them in my database. Tables are there and okay. Does anyone see the problem? Thank you for your help. SS-Version is 2.4.5 with latest version of the DataObject_Manager Module.

Carbon Crayon

3 May 2011 at 9:46am Community Member, 598 Posts

Hi Oleze,

I think your many_many relationship should be:

static $belongs_many_many = array(
'Pages' => 'ReferencePage'

Aram - Your one stop SilverStripe learning resource.


3 May 2011 at 9:05pm Community Member, 65 Posts

Thank you Aram,
the problem is:

Those Brochures also belong to VehiclePages and others. Do you think that's the problem? Do I need e many_many relation for every Page type a Brochure belongs to?

Carbon Crayon

3 May 2011 at 10:46pm Community Member, 598 Posts

Hi Oleze,

You either need to add the many_many static to Page.php along with the DOM, or you need to add a number of belongs_many_many in the DataObject, otherwise SS is gonna get confused because you are telling it it belongs to a relationship on the Page class, but there is no relationship defined on that Class.

Aram - Your one stop SilverStripe learning resource.


3 May 2011 at 11:34pm Community Member, 65 Posts

Okay, I changed my code to:

static $belongs_many_many = array(
'ReferencePages' => 'ReferencePage',
'VehiclePages' => 'VehiclePage'

I still can't see the DataObjects (Brochures) on my ManyManyFileDataObjectManager in the backend. The tables and ID's match each other for all relations in my database....

Carbon Crayon

3 May 2011 at 11:50pm Community Member, 598 Posts

What happens if you create a new one? Does it show in the DOM?

What is the db table called?



4 May 2011 at 2:51am Community Member, 65 Posts

Nope, doesn't show up. Tables are called "ReferencePage_Brochures" and "VehiclePage_Brochures". Brochures are saved in the "Brochure" table which joins "File". Everything as it should be, I think.....


4 May 2011 at 3:59am 4085 Posts

ManyManyFileDOM doesn't manage File or File subclasses. It manages DataObject subclasses that have a file relation within them.

Go to Top