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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

ComponentSet relationships


Go to End


10 Posts   2773 Views

Avatar
swaiba

Forum Moderator, 1899 Posts

15 September 2010 at 8:28pm

It might help if you showed both object's code (and removed everything but the required stuff) it sounds like you might want a many to many relationship, but you only have many to one?

SS has some great handling of relationships with little code - I never use a direct db query - and when i do start loading sql into DataObject::get it is for performance optimisation only.

Avatar
dendeffe

Community Member, 135 Posts

17 September 2010 at 1:46am

Ok, I got it working by setting the properties on a new Order_Item object and then saving it. Seems to work nicely.

If you’re interested (or have more advice), this is the complete code I ended up using: http://pastie.org/1162797

Go to Top