I'm trying to remove a certain Entity
from the collection in a EntityCollection
, which is not working, results in an exception: list.remove(x): x not in list
.
Code excerpt as follows:
user.platformSubscriptions.remove(platform)
The platform variable is in fact in the platformSubscriptions collection.
The reason it didn't work was probably because there was no proper comparator function for the platform object. So the solution is to loop through
platformSubscriptions
to find a match forplatform
by comparing theid
field: