projectwonder/wonder — pull request #66 by darkv (2011-11-08 15:42:53+00:00)
Title: ERXDatabaseContextDelegate patch

The methods batchFetchToOneFault and batchFetchToManyFault are checking first if there is an array of objects in the thread storage for the key 'ERXBatching'. To check if that array is good for processing the last object is checked for its type.
In special cases you can have different types of objects in the array so the type of the last one could differ from part of the rest of the array. In the following for loop those items will be cast to EOEnterpriseObject which can cause class cast exceptions.

The patch will go through the array from the thread storage and pick only the items that are of type AutoBatchFaultingEnterpriseObject as only those will be processed later on anyway. Should there be no items left then it falls back to ec.registeredObjects().