Jump to:

5554 Posts in 1742 Topics by 1227 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Overwritten publish function doesn't work in SS 2.4.0 b1

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

Page: 1
Go to End
Author Topic: 990 Views
  • mco
    Avatar
    Community Member
    14 Posts

    Overwritten publish function doesn't work in SS 2.4.0 b1 Link to this post

    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.

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: Overwritten publish function doesn't work in SS 2.4.0 b1 Link to this post

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

  • mco
    Avatar
    Community Member
    14 Posts

    Re: Overwritten publish function doesn't work in SS 2.4.0 b1 Link to this post

    sorry. forgot about the posting.

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

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