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   924 Views

Avatar
UncleCheese

Forum Moderator, 4096 Posts

5 September 2008 at 8:19am

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

Forum Moderator, 5513 Posts

5 September 2008 at 3:57pm

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

Avatar
UncleCheese

Forum Moderator, 4096 Posts

6 September 2008 at 1:29am

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.