Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Error when trying out the FileDataObjectManager

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: 1241 Views
  • adesweb
    Avatar
    Community Member
    39 Posts

    Error when trying out the FileDataObjectManager Link to this post

    Hi,

    I am following the tutorial for this module in the documentation. The DataObjectManager (Testimonial stuff) works fine. However, the next bit for the ResourcePage comes up with this error when adding a new page in the CMS:

    ERROR [User Error]: getCMSFields returned null on a 'Page' object - it should return a FieldSet object. Perhaps you forgot to put a return statement at the end of your method?
    IN POST /silverstripe/admin/getitem?ID=6&ajax=1
    Line 392 in /home/adrianw/PROJECTS/sandbox/silverstripe/cms/code/CMSMain.php

    Source
    ======
    383:

    384:    public function getEditForm($id) {

    385:       $record = $this->getRecord($id);

    386:

    387:       if($record) {

    388:          if($record->IsDeletedFromStage) $record->Status = _t('CMSMain.REMOVEDFD',"Removed from the draft
    site");

    389:

    390:          $fields = $record->getCMSFields($this);

    391:          if ($fields == null) {

    * 392:             user_error("getCMSFields returned null on a 'Page' object - it should return a FieldSet object.
    Perhaps you forgot to put a return statement at the end of your method?", E_USER_ERROR);

    393:          }

    394:          $fields->push($idField = new HiddenField("ID"));

    395:          $fields->push($liveURLField = new HiddenField("LiveURLSegment"));

    396:          $fields->push($stageURLField = new HiddenField("StageURLSegment"));

    397:

    398:          /*if( substr($record->ID, 0, 3 ) == 'new' )*/

    <ul>user_error(getCMSFields returned null on a 'Page' object - it should return a FieldSet object. Perhaps you forgot to put a return statement at the end of your method?,256)
    line 392 of CMSMain.php

    CMSMain->getEditForm(6)
    line 925 of LeftAndMain.php

    LeftAndMain->EditForm()
    line 380 of LeftAndMain.php

    LeftAndMain->getitem(HTTPRequest)
    line 162 of Controller.php

    Controller->handleAction(HTTPRequest)
    line 129 of RequestHandler.php

    RequestHandler->handleRequest(HTTPRequest)
    line 122 of Controller.php

    Controller->handleRequest(HTTPRequest)
    line 277 of Director.php

    Director::handleRequest(HTTPRequest,Session)
    line 121 of Director.php

    Director::direct(/admin/getitem)
    line 118 of main.php

    </ul>

    Can you help? I am using the latest version of Silverstripe (2.3.2)

    Adrian

  • adesweb
    Avatar
    Community Member
    39 Posts

    Re: Error when trying out the FileDataObjectManager Link to this post

    Apologies, have realised the error. The two lines are missing from the tutorial code:

    $f->addFieldToTab("Root.Content.Resources", $manager);
    return $f;

    Cheers,

    Adrian

  • UncleCheese
    Avatar
    4085 Posts

    Re: Error when trying out the FileDataObjectManager Link to this post

    Thanks for pointing that out. I'll make the update.

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