Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

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

Call to undefined method stdClass::write()


Reply


4 Posts   2071 Views

Avatar
nicktacular

Community Member, 8 Posts

26 January 2010 at 3:40am

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?

Avatar
nicktacular

Community Member, 8 Posts

3 February 2010 at 2:48am

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

Thanks

Avatar
martimiz

Forum Moderator, 1105 Posts

3 February 2010 at 4:12am

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

Avatar
nicktacular

Community Member, 8 Posts

3 February 2010 at 5:39am

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