Jump to:

23377 Posts in 18296 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » Call to undefined method stdClass::write()

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: 1988 Views
  • nicktacular
    Avatar
    Community Member
    8 Posts

    Call to undefined method stdClass::write() Link to this post

    I have been working on a project that I commit to SVN and just checked that project out to the server. It has been working on the dev server for quite some time until the latest update to the code which had nothing to do with the file being referred to. I can't seem to understand this error as it seems to be coming from outside of SilverStripe:

    Fatal error: Call to undefined method stdClass::write() in /......../code/WebPageRequestMultiForm.php on line 38

    The line of code being referred to (and preceding lines):

    $webReq = new WebPageRequest();
    $webReq->update($finalData);
          
          //now save the resources and their web request (the one we just saved)
          $records = array();
          foreach ($ResID as $ID)
          {
             $record = DataObject::get_one('ProjectResource', "`ProjectResource`.`ID`='$ID'");
             $record->WebPageRequestID = $webReq->ID;
    ->         $record->write();

    This is a very simple write statement on an object of type DataObject.

    And yes, all the directories are owned (therefore r/w) by apache so permissions don't appear to be a problem, as per some other posts.

    Any direction with regards to this?

  • nicktacular
    Avatar
    Community Member
    8 Posts

    Re: Call to undefined method stdClass::write() Link to this post

    Any ideas at all would be very helpful. This is an urgent matter. Even just ideas will help.

    Thanks

  • martimiz
    Avatar
    Forum Moderator
    1068 Posts

    Re: Call to undefined method stdClass::write() Link to this post

    Did you check that every get_one in fact returns a valid DataObject?

  • nicktacular
    Avatar
    Community Member
    8 Posts

    Re: Call to undefined method stdClass::write() Link to this post

    Thanks so much for helping! You're right, I didn't do the basic checking. I really appreciate your help!

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