private function hydrateDocument($document) { if ($document !== null && $this->class !== null) { return $this->unitOfWork->getOrCreateDocument($this->class->name, $document); } return $document; }