public function calculateByIteration(Collection $collection) { // If the list hasn't been fetched, sizeof() will still calculate it with an Aggregate, // so we need for force the list to be fetched now so the sizeof() can calculate by iteration $collection->fetchList(); return sizeof($collection); }