wocommunity/wonder — pull request #482 by rachelhan1024 (2013-09-24 02:34:34+00:00)
Title: Ensure in-memory evaluation of selector over NSArray has the same result as generated SQL fetch

Current behaviour of in-memory evaluation of selector over a toMany and/or manyToMany and/or multiple levels of relationship is not correct.

First scenario
i.e. an entity Person has a toMany relationship to entity PersonName
When we evaluate either of the following qualifiers over a person or a person array:
Person.PERSON_NAMES.dot(PersonName.FIRST_NAME).startsWithInsensitive("Jennie");
or
Person.PERSON_NAMES.dot(PersonName.FIRST_NAME).contains("Jenni").and(Person.PERSON_NAMES.dot(PersonName.ACTIVE_FLAG).eq(1));

Second scenario
i.e. an entity Team has a toMany relationship to entity Person. And Person entity as a toMany relationship to entity PersonName.
When we evaluate the following qualifiers over a person or a person array:
Team.PERSONS.dot(Person.PERSON_NAMES).dot(PersonName.FIRST_NAME).contains("Jenni").and(Team.PERSONS.dot(Person.PERSON_NAMES).dot(PersonName.FIRST_NAME).contains("Lenni"));

The returned result from invoking method EOKeyValueQualifier.evaluateWithObject(Object obj) was always false due to a bug in WebObjects core.

We could get the misbehaviour from invoking the following methods:
1) ERXArrayUtilities.filteredArrayWithQualifierEvaluation(arrayOfPersonToEvaluate, qualifierAsExample)
2) ERXQ.filtered(arrayOfPersonToEvaluate, qualifierAsExample)
3) ERXKeyValueQualifier.evaluateWithObject(aPersonEO)
there are more...