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:

Customising the CMS /

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

Overwritten publish function doesn't work in SS 2.4.0 b1


Go to End


3 Posts   1296 Views

Avatar
mco

Community Member, 14 Posts

24 February 2010 at 1:35am

Following code did work just fine in SS 2.3.4:

class XYZ extends Page {
...
function publish($fromStage, $toStage, $createNewVersion = false) {
// do something
return $this->extension_instances['Versioned']->publish($fromStage, $toStage, $createNewVersion);
}
...
}

since 2.4.0 i get an error, when publishing the site:
"Save and Publish" -> "Error saving content"

However the site is getting published and my custom code is getting executed...

* Did the function header of "function publish()" change?
* Do I still need to call $this->extension_instances['Versioned']->publish... ?
* Is it a bug in 2.4.0 b1?

Thanks for the Input.

Avatar
Ingo

Forum Moderator, 801 Posts

25 March 2010 at 10:44pm

The discussion went on a bit at http://open.silverstripe.org/ticket/5112. @mco: If you ask on the forum *and* open a ticket at the same time, please make sure to link between both, otherwise people will try to solve stuff in two different places... :)

Avatar
mco

Community Member, 14 Posts

8 April 2010 at 2:56am

sorry. forgot about the posting.

However, using onBeforeWrite solves the issue and seems to be the propper way.