private function doRefresh($document, &$visited)
{
$oid = spl_object_hash($document);
if (isset($visited[$oid])) {
return;
}
$visited[$oid] = true;
if ($this->getDocumentState($document) !== self::STATE_MANAGED) {
throw new InvalidArgumentException('Document has to be managed to be refreshed ' . self::objToStr($document, $this->dm));
}
$node = $this->session->getNode($this->getDocumentId($document));
$class = $this->dm->getClassMetadata(get_class($document));
$this->cascadeRefresh($class, $document, $visited);
$hints = array('refresh' => true);
$this->getOrCreateDocument(ClassUtils::getClass($document), $node, $hints);
}