The method 'publish' does not exist on 'Page'

Silverstripe Version: 5

Question:

It has been a long time since I have used Silverstripe, so I am a little rusty. I am trying to upgrade a site from Silverstripe 3.6 to Silverstripe 5. The site uses Elemental and I have gotten the site upgraded. However if I try to save or publish a block I am getting an internal server error that is:

[2023-10-10T09:11:42.313147+00:00] error-log.ERROR: Uncaught Exception BadMethodCallException: “Object->__call(): the method ‘publish’ does not exist on ‘Page’” at D:\wamp\www\site\vendor\silverstripe\framework\src\Core\CustomMethods.php line 57 {“exception”:"[object] (BadMethodCallException(code: 0): Object->__call(): the method ‘publish’ does not exist on ‘Page’ at D:\wamp\www\site\vendor\silverstripe\framework\src\Core\CustomMethods.php:57)"}

I have looked in both the Page.php and PageController.php files that come with a fresh install of Silverstripe 5 and there does not appear to be any functions that I have missed copying over.

Can anyone shed any light on what I am missing?

Thank you.

Please check the CMS 5.0.0 changelog.

Removed deprecated method SilverStripe\Versioned\Versioned::publish() - use SilverStripe\Versioned\Versioned::copyVersionToStage() instead

You could also see if SilverStripe\Versioned\RecursivePublishable::publishRecursive() suits your requirement better.

Thanks for your help. That solved the issue.