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've moved the forum!

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.

All other Modules /

Discuss all other Modules here.

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

extending DataExtension


Go to End


4 Posts   1404 Views

Avatar
Riposte

Community Member, 10 Posts

6 August 2013 at 4:52pm

Edited: 06/08/2013 4:53pm

Hi All
I'm not exactly top shelf when it comes to the coding stuff and could use a bit of help with where to look for the error causing my problem.
I have made a minor extension to the CalendarDateTime Class to add three new fields:
New file MeetDetails.php in mysite/code folder:
<?php

class MeetDetails extends DataExtension
{
private static $db = array(
'Location' => 'Text',
'Entries Close' => 'Date',
'No Times' => 'Boolean'
);

private static $has_one = array (
'Event' => 'CalendarEvent'
);

public function updateCMSFields(FieldList $fields) {

$fields->push(new TextField('Location', 'Location'));
$fields->push(new DateField('Entries Close', 'Date Entries Close'));
$fields->push(new CheckboxField('No Times', 'No Times Allowed'));
}
}

and added;
Object::add_extension('CalendarDateTime', 'MeetDetails');

to my _config.php file.

Ran dev/build?flush=1 and new fields appear in database and in CMS as expected.

The problem is only the 'Location" textfield will save any data. With the other two you can set them all you like but they wont save anything.
Pushing the 'Save" button reloads the page but the two fields reset to blank.

Where should I start looking to solve this?

Any help appreciated.

Avatar
Riposte

Community Member, 10 Posts

16 August 2013 at 4:02pm

Edited: 16/08/2013 4:09pm

Still havn't solved this - have I logged it in the right part of the forum?
A advice on how to debug this sort of problem even?

Avatar
dhensby

Community Member, 253 Posts

16 August 2013 at 7:39pm

Try removing the spaces from the DB field names?

Avatar
Riposte

Community Member, 10 Posts

17 August 2013 at 10:47am

Thanks Pigeon - that sorted it.
New it would be something simple that would probably highlight my noobishness (is that a word?).