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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

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

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

Call to undefined method stdClass::write()

Go to End

4 Posts   3208 Views


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();
		//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?


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.



Forum Moderator, 1391 Posts

3 February 2010 at 4:12am

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


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!