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

ManyManyList add method


Go to End


2 Posts   1048 Views

Avatar
michael_geeky

Community Member, 10 Posts

22 October 2013 at 1:03pm

Edited: 22/10/2013 1:04pm

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

Community Member, 10 Posts

22 October 2013 at 1:20pm

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