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.

General Questions /

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

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

ComponentSet relationships


Go to End
Reply


10 Posts   2042 Views

Avatar
swaiba

Forum Moderator, 1805 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