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:

Data Model Questions /

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

How to create & publish a Page with the ORM

Go to End

2 Posts   1776 Views


Community Member, 14 Posts

8 December 2009 at 9:47am

Edited: 08/12/2009 9:48am

Hi all,

i attempt to create & publish an Page with the ORM till 5 hours now. The Problem i see, is the versioning. I can't find a Dokumentation of this SS Part. Now, i need help.

My Code Snippet :

Referenz extends Page { ... }


ReferenzHolder extends Page {

$referenz = new Referenz();						
$referenz->ParentID = $this->dataRecord->ID; // ID of ReferenzHolder
$referenz->Title = $data['Title'];
$referenz->Status = "Published"
$referenz->publish('Stage', 'Live');

SS creates two Records in SiteTree. One ReferenzHolder and one Referenz. My Questions :

1. Why SS creates an ReferenzHolder?
2. Why SS creates the two Records with the Status Attribute "New Page" instead of "Published"?

If anyone has a link to some Documentions about creating & publishing Pages with ORM, i become relieved.




Community Member, 27 Posts

28 December 2009 at 2:22am


I'm not sure about #1. I suspect we may need to see more of your code to figure out why a ReferenzHolder is being created. I think I was having a similar problem to your #2, though, with code that looked pretty similar. Here's what fixed it for me:

// change this:

// to this:

Because I was running my code on the frontend side, which was currently in Live mode, the write() call was saving to the live table and then the publish from stage to live was actually overwriting it. This way, it correctly saves to the Stage table, then publishes from Stage to Live.

Hope that helps,