Jump to:

23367 Posts in 18143 Topics by 2863 members

General Questions

SilverStripe Forums » General Questions » *** Solved *** 2.4.9 ImageDataObjectManage

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 221 Views
  • Johan
    Avatar
    Community Member
    49 Posts

    *** Solved *** 2.4.9 ImageDataObjectManage Link to this post

    Hi

    ImageDataObjectManage used to work on other sites, but on a new site using 2.4.9 and the same dataobject manager adding this code generates an error in the CMS

          $fields->addFieldToTab('Root.Content.Images', new ImageDataObjectManager(
                $this,
                'Photos',
                'Photo',
                'Image',
                array('Title'=>'Title', 'Image'=>'Image')
             )
          );

    Obviousely I have:

       static $has_many = array(
          'Photos'=>'Photo'
       );
       

    Is there a workaround?

  • Johan
    Avatar
    Community Member
    49 Posts

    Re: *** Solved *** 2.4.9 ImageDataObjectManage Link to this post

    I needed to add the data object for my gallery photos

    <?php

    class Photo extends DataObject {
       static $db = array(
          'Title' => 'Varchar(128)'
       );
       
       static $has_one = array(
          'Image'=>'Image',
          'ParentPage'=>'Page'
       );
    }

    221 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.