In my experience $xpdo->getCount() on cascaded result sets isn't overly accurate. I'd stay away from it, except for straight getCollection() type queries.
Try something like this:
/**
* Counts the items in a multi-dimensional array and returns the total count
*
* @param array $a
* A multidimensional array
* @return int The number of items in an array or zero if not an array
*/
public function count_nested_array_keys (array $a) {
$out = (is_array($a)) ? count($a, COUNT_RECURSIVE) : 0;
return $out;
}
Simply perform your getCollectionGraph(), getObjectGraph() retrieve a collection and throw it at the function.
I'm pretty sure it will work for you.
Not sure if you have seen this tucked into the xPDO class:
/**
* Update field values across a collection of xPDOObjects.
*
* @param string $className Name of the class to update fields of.
* @param array $set An associative array of field/value pairs representing the updates to make.
* @param mixed $criteria An xPDOCriteria object or representation.
* @return bool|int The number of instances affected by the update or false on failure.
*/
public function updateCollection($className, array $set, $criteria= null) {...}
I'm building against a 10 year old WSDL platform now so I feel your pain.
Fortunately, I can grab each section of the feed through a couple dozen API pulls so I can target the data set I want, do a getCollection, loop through it and update only those records which have changed by comparing each object's field against its incoming counterpart. If a change is detected, then I save the current date set over the top of the old one.
Here's a post with some info which may help:
http://stackoverflow.com/questions/9866920/whats-the-fastest-way-to-compare-two-objects-in-php
PHP.net:
http://php.net/manual/en/language.oop5.object-comparison.php
The second link suggests you could create two objects with the data (supposedly the same one base on some fixed key on the incoming data set):
$testObj = $modx->newObject('somwClass', $incomingArray);
$currentObj = $modx->getObject('someClass', $testObj->get('remoteKey');
Then run them through some comparison apparatus.
Hope this helps.