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

FileDataObjectManger no output


2 Posts   705 Views


9 December 2009 at 5:25am Community Member, 19 Posts

I am having an issue that despite having all the files showing up with in the back end, I can't get them to render on the front end...

This is my code

class Download extends DataObject {
   static $db = array(
   'date' => 'Text',
   'description' => 'Text'
   static $has_one = array(
   'TheDownload' => 'File'   
   static $belongs_many_many = array (
      'Download' => 'Downloads'
function getCMSFields_forPopup() {
$fields = new FieldSet();
    $fields->push(new TextField('date','Date Created'));
    $fields->push(new TextField('description','Description of file'));
    $fields->push(new FileIFrameField('TheDownload'));
return $fields;

class Downloads extends Page {
static $db = array(

static $has_one = array(


   static $many_many = array(
      'TheDownloads' => 'Download'


   function getCMSFields() {
      $fields = parent::getCMSFields();
            $manager = new FileDataObjectManager(
               $this, // Controller
               'TheDownloads', // Source name
               'Download', // Source class
               'TheDownload', // File name on DataObject
                  'Date' => 'Date',
                  'Description' => 'Description',
               ), // Headings
               'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
               // Filter clause
               // Sort clause
               // Join clause
       return $fields;

   <table class="downloads">
                        <% control TheDownloads %>
                           <td><a href="$TheDownload.URL" target="_new"><img src="/themes/howell/images/icons/page_white_acrobat.png" alt="Download "/></a></td>
                        <% end_control %>

Any ideas as to what I am doing? It just outputs the table headers and nothing else ->


9 December 2009 at 5:56am 4085 Posts

The biggest issue you have is that you're using a FileDOM to manage a many_many relationship, when you should be using a MMFileDOM.

The other thing is that your naming conventions are extremely confusing and redundant. I wouldn't be surprised if that's tripping up the ORM. You have two fields named "TheDownload".. "Download" is a belongs_many_many field and it's also a class. I don't know how you keep track of all that!