Jump to:

22999 Posts in 11854 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » ComponentSet relationships

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

Page: 1 2
Go to End
Author Topic: 1788 Views
  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: ComponentSet relationships Link to this post

    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.

  • dendeffe
    Avatar
    Community Member
    135 Posts

    Re: ComponentSet relationships Link to this post

    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

    1788 Views
Page: 1 2
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.