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

ComponentSet relationships

Go to End

10 Posts   2590 Views


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.


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:

Go to Top