Jump to:

3460 Posts in 1064 Topics by 739 members

Data Model Questions

SilverStripe Forums » Data Model Questions » has_many Files and AssetTableField

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

Page: 1
Go to End
Author Topic: 1427 Views
  • netnoise
    Avatar
    Community Member
    10 Posts

    has_many Files and AssetTableField Link to this post

    Hi!

    I am trying to use the AssetTableField for linking multiple files to a page, but the selection in AssetTableField does not get saved. Did I miss some point? Any hint is highly appreciated.

    Thanks!

    <?php

    class ContentPage extends Page {
       
       // database relations
       public static $db = array(
       );
       
       public static $has_one = array(
       );
       
       public static $has_many = array(
          'Files' => 'File'
       );   

       // fields in CMS
       function getCMSFields() {
          $fields = parent::getCMSFields();
          $downloadsTable = new AssetTableField(
             $this,
             'Files',
             'File',
             array(
                'Title' => 'Bezeichnung',
                'Filename' => 'Dateiname'
             )
          );
             
          $fields->addFieldToTab('Root.Content.Downloads', $downloadsTable);
          
          return $fields;
       }
       
    }
    ?>

  • johannes
    Avatar
    Community Member
    20 Posts

    Re: has_many Files and AssetTableField Link to this post

    Same problem here, can't anybody help with this?

  • timcole
    Avatar
    Community Member
    32 Posts

    Re: has_many Files and AssetTableField Link to this post

    I my experience the DataObjectManager module (which includes FileObjectManager) is generally an easier and nicer way to do these sorts of things. Take a look on the modules page for it - there are some good tutorials and a specific area on the forum.

    1427 Views
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.