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.

Data Model Questions /

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

Two Has-one and one Has_many dataobject


Go to End


947 Views

Avatar
XorPush

Community Member, 10 Posts

23 November 2014 at 2:08am

I am trying to do the following:

I need a list for Destinations something like:

Destination 1
Company 1 : price from offer for the given Destination
Company 2 : price from offer for the given Destination
Company 3 : price from offer for the given Destination

Destination 2
Company 1 : price from offer for the given Destination
Company 2 : price from offer for the given Destination
Company 3 : price from offer for the given Destination
etc...

This is how I would create it but not sure if I am correct since haven't coded for two years:
Three DataObjects: Destination , Company and Offers.
Offer has one destination and has one offering company, but Company and Destination has many Offers.

Traversing based on Destination can't be done with 'Children' if I am correct.

I will be grateful for any suggestions!