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, Ed, biapar, Willr, Ingo

has_one without a table?

Go to End

3 Posts   1082 Views


Forum Moderator, 4102 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?


Forum Moderator, 5523 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"


Forum Moderator, 4102 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.