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.

Archive

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

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

has_one without a table?


Reply

3 Posts   900 Views

Avatar
UncleCheese

5 September 2008 at 8:19am 4085 Posts

An event has_one DateTime. How can I update the DateTime DataObject associated with the event with just textfields?

static $has_one = array (
'DateTime' => 'DateTime'
);

// getCMSFields
...

new TextField('DateTime.StartDate', 'Start Date');
new TextField('DateTime.StartTime', 'Start Time');

... doesn't work. Any way to to this?

Avatar
Willr

5 September 2008 at 3:57pm Forum Moderator, 5511 Posts

Do you need to use has_one? cant you just have 2 fields on the database "StartDate" and "StartTime"

Avatar
UncleCheese

6 September 2008 at 1:29am 4085 Posts

Yeah, that's the thing. The dataobject DateTime is shared across two modules. The other module can add to it in with a has_many relationship, but this module has a has_one. On the frontend I just want to be able to get all of them regardless of where they came from.