There is no more column Status in the SiteTree table in SS3.
Is there any standard way to get published pages only, e.g. PageClass::get()->filter("Status"=>"Published") or anything similar?
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
There is no more column Status in the SiteTree table in SS3.
Is there any standard way to get published pages only, e.g. PageClass::get()->filter("Status"=>"Published") or anything similar?
I don't think you need to worry about this. Because it seems that in SS3
Page::get()->filter($filter);
will only return published pages. Try this yourself by simply un-publishing a page in a filter...
public function getBlogEntrys() {
$blogEntrys = BlogEntry::get()->filter(array("ParentID" => $this->ID))->sort(BlogEntry::$item_sort);
return $blogEntrys;
}
I have the same problem. Very annoyingly, when logged in, get() will also return any unpublished and even deleted items, while it only returns the published items while not logged in. This makes it quite cumbersome to test while logged in to my website.
I have not found a solution to this yet. I wish the website only behaved differently for logged in users when stage=Stage was used in the URL or something like that.
Totally agree with you that the logged-in behaviour is confusing at best.
you can use something like Versioned::get_by_stage (see: http://doc.silverstripe.org/en/developer_guides/model/versioning)
Hope that helps
Nicolaas