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

ManyManyList add method


Reply

2 Posts   215 Views

Avatar
michael_geeky

22 October 2013 at 1:03pm (Last edited: 22 October 2013 1:04pm), Community Member, 10 Posts

Hi,

I know ManyManyList::add() will change the relation table, but what I am actually after is a way to simply add a new relation to the result list rather than change the table. I have a many_many table and I want to retrieve say, 3 records, but I only get 2 records (obj2) from $obj1->obj2s(), so I want to add a new obj2 from Obj2::get(), add add it to the manymanyList result.

Cheers!

Avatar
michael_geeky

22 October 2013 at 1:20pm Community Member, 10 Posts

Ok, I figured it out myself. Using an ArrayList instead.