Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » [SOLVED] Problem Adding DataObjectManager

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: 685 Views
  • zenmonkey
    Avatar
    Community Member
    527 Posts

    [SOLVED] Problem Adding DataObjectManager Link to this post

    I can't seem to add the DOM to CMS, its working in other page types, It must be a typo I'm not seeing

    Here is the DataObject

    class AccessCodeUser extend DataObject {
       static $db - array(
                    'Name' => 'Text',
                    'Email' => 'Text',
                    'ProductName' => 'Text'
                    );
       
       static $has_one = array(
          'AccessCodePage' => 'AccessCodePage',      
       );
       
       public function getCMSFields_forPopup()
       {
          return new FieldSet (
                          new TextField('Name'),
                          new EmailField('Email'),
                          new TextField('ProductName')
                          );
       }
    }

    And in the PageType

    class AccessCodePage extends Page {
       public static $db = array(
                          'LifestyleText' => 'HTMLVarchar(255)',
                          'AccessCode' => 'Text'
                          );
       
       public static $has_many = array (
                          'ExtraPageImages' => 'ExtraPageImages',
                          'AccessCodeUsers' => 'AccessCodeUser'
       );
       
       function getCMSFields() {
          $f = parent::getCMSFields();
          
          $f->removeFieldFromTab('Root.Content.Main', 'LifestyleText');
          $f->addFieldToTab("Root.Content.AccessCode", new TextField("AccessCode","Access Code"));
          $f->addFieldToTab("Root.Content.AccessCode", new DataObjectManager(
                                                           $this,
                                                           'AccessCodeUsers',
                                                           'AccessCodeUser',
                                                           array('Name' => 'Name','Email'=>'Email','ProductName' => 'ProductName'),
                                                           'getCMSFields_forPopup'
                                                           ));
          
          
          return $f;
          
       }
       
    }

  • UncleCheese
    Avatar
    4085 Posts

    Re: [SOLVED] Problem Adding DataObjectManager Link to this post

    What do you mean you "can't?" Errors? What's it doing/not doing?

  • zenmonkey
    Avatar
    Community Member
    527 Posts

    Re: [SOLVED] Problem Adding DataObjectManager Link to this post

    Standard White Screen when Accessing the CMS even in Devmode. Everything is fine until I add the DataObejctManager.

    EDIT Found the Typo

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