Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » FileDataObjectManager Issue

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 814 Views
  • aTTi
    Community Member
    19 Posts

    FileDataObjectManager Issue Link to this post

    Hey Guys

    I'm using the FileDataObjectManager and have (I guess) 1 simple Problem.

    I created a FileDataObject Called "Downloads" where I can add some Files to download.
    When I creat another Page with the Download section included and add there different Files the output looks like:


    added blabla.pdf
    output -> blabla.pdf

    Testsite 2
    added blua.pdf
    output -> blabla.pdf



    class Download extends DataObject {

    static $db = array (
    'Name' => 'Text',

    static $has_one = array (
    'Attachment' => 'File',
    'ImageGalleryPage' => 'ImageGalleryPage'

    public function getCMSFields_forPopup()
          return new FieldSet(
             new TextField('Name'),
             new FileIFrameField('Attachment')



    $manager = new FileDataObjectManager(
    array (
    'Name' => 'Name'

    function Download() {
    $DownloadData = DataObject::get("Download","ID = ".$this->ID); //I Also tried "Download","ParentID = ".$this->ID
       return $DownloadData;

    Is there a solution for this? I only want to Publish the Files from the Current Sites.

    Sorry for my bad english

    Best regards aTTi

  • aTTi
    Community Member
    19 Posts

    Re: FileDataObjectManager Issue Link to this post

    ...Solved my Problem.

    For others:

    The Problem was, there are 3 "ID's" in the Database

    ID (DB-ID)

    So i just had to rewrite the function Download like:

    function Download() {
    $DownloadData = DataObject::get("Download","ImageGalleryPageID = ".$this->ID);
       return $DownloadData;

    Best regards,


  • UncleCheese
    4085 Posts

    Re: FileDataObjectManager Issue Link to this post

    Your function isn't necessary, because you already have a relation defined as "Downloads"..

    $this->Downloads() will give you what you need.

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.