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.

Data Model Questions /

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

write() updates _Live table only

Go to End

3 Posts   2171 Views


Community Member, 47 Posts

2 September 2010 at 3:45pm

I have a custom page type with a form, on the forms action I'm updating an object:

$myObj = DataObject::get_by_id("myObj", $Id);
$myObj->myProperty = 2;

But this only updates the _Live table and not the draft table, how can I update the draft table so it shows in the CMS?

Thank you


Community Member, 47 Posts

2 September 2010 at 4:35pm

Edited: 02/09/2010 4:35pm

All I needed was to add $myObj->publish("Live", "Stage"); after the write() function.

Thanks to this post which I found via google and not this forum search:

This forum really needs a better search feature, there is lots of information but you can't get to it :(


Forum Moderator, 5523 Posts

2 September 2010 at 7:22pm

In the development version of the forum we now have the search powered by the much more useful sphinx search engine. Initial tests show results are better but we're still lacking an 'advanced' search form. This forum will be upgraded to include this sphinx search extension before the end of the year.