private function detectEndlessRecursion(ObjectRef $objectRef, Scope $scope, array &$allFetchedObjects) { $fetchHash = $objectRef->getEntity()->getName() . "[" . $objectRef->getId() . "]"; $fetchedScopeValue = NULL; if (array_key_exists($fetchHash, $allFetchedObjects)) { $fetchedScopeValue = $allFetchedObjects[$fetchHash]; } $allFetchedObjects[$fetchHash] = $scope->removeRecursingScopeValues($fetchedScopeValue); return $scope; }