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:

Archive /

Our old forums are still available as a read-only archive.

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

Tutorial 2 - Date / Author Not Saving

Go to End

4 Posts   1517 Views


Community Member, 6 Posts

20 September 2008 at 7:23am

While working through tutorial 2 I was able to add the Date and Author the the main tab in ArticlePage and get it to show up in the tab itself. But when I create the news story and save or publish, the data for the added fields Date and Author did not save properly though the rest of the content did.

My ArticalePage.php:
* Defines the ArticlePage page type
class ArticlePage extends Page {
static $db = array(
'Date' => 'Date',
'Author' => 'Text'

static $has_one = array(

function getCMSFields() {
$fields = parent::getCMSFields();

$fields->addFieldToTab('Root.Content.Main', new CalendarDateField('Date'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content');

return $fields;

class ArticlePage_Controller extends Page_Controller {


I'm doing this in my site and this file lives in mysite/code directory.

Is there something small / obvious that I'm missing? The best I can tell my code is basically verbatim from the tutorial.




Community Member, 6 Posts

20 September 2008 at 7:46am

OK, so what seemed like the 50th time I did /db/build and it finally created the tables.

So my question now is - is there a difference between /db/build/?flush=1 and simply /db/build?

If both are valid, when is each appropriate?


Community Member, 712 Posts

20 September 2008 at 9:24am

I always use db/build?flush=1. Flushing does a bunch of extra stuff, and generally if you've changed your classes you need to flush.


Community Member, 6 Posts

20 September 2008 at 9:28am

That's interesting as /db/build/?flush=1 was how I was doing it, but it wasn't until I only did /db/build were the new tables added to the database. I'll watch more closely the next time I do this. Only my 2nd day working with SS, but to this point like what I see over all.