Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » has_one without a table?

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

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

Page: 1
Go to End
Author Topic: 891 Views
  • UncleCheese
    Avatar
    4085 Posts

    has_one without a table? Link to this post

    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?

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: has_one without a table? Link to this post

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

  • UncleCheese
    Avatar
    4085 Posts

    Re: has_one without a table? Link to this post

    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.

    891 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.