I have 2 object arrays like these:
Array 1
[{"id":1,"relationship_type_id":"3"},
{"id":2,"relationship_type_id":"2"},
{"id":3,"relationship_type_id":"1"},]
Array 2
[{"relationship_type_id":1,"contributing":"yes"},
{"relationship_type_id":2,"contributing":"no"},
{"relationship_type_id":3,"contributing":"yes"}]
How do I find out which ids in array 1 has a relationship type that is contributing i.e. contributing == "yes" based on array 2?
The results should look like this:
Result 1
[{"id":1}, {"id":3}]
Or further more, just returning the amount of contributing relationships
Result 2
contributingRelationship = 2