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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Versioned objects do not work in ContentController


Reply


556 Views

Avatar
walec51

Community Member, 16 Posts

15 May 2010 at 5:25am

Did any one notice this ?

If you make a method like this:

public function viewermakesoffer() {

   $page = new Page();
   $page->Title = "xxxxxx";
   $page->MenuTitle = "xxxxxx";
   $page->URLSegment = "xxxxxxx";
   $page->Status = "Published";
   $page->write();
   $page->publish("Stage", "Live");
   return;
}

In a ContentController and execute it by calling the right url the versioning mechanizm will go bizzare and create a nullafied SiteTree object in the database.

But the method will work ok if you put it in plain Controller.

Filed it in: http://open.silverstripe.org/ticket/5596