Services/Mapping/EntityToDocumentMapper.php
protected function fillDocument(Document $document, object $object) : bool {
		if($object instanceof SearchableEntity) {
			return $object->indexEntity($document);
		}
		$mapping = $this->getMapping(\get_class($object));
		$accessor = PropertyAccess::createPropertyAccessor();
		foreach($mapping as $fieldName => $propertyPath) {
			$document->addField($fieldName, $accessor->getValue($object, $propertyPath));
		}
		return true;
	}
protected function fillDocument(Document $document, object $object) : bool {
		if($object instanceof SearchableEntity) {
			return $object->indexEntity($document);
		}
		$mapping = $this->getMapping(\get_class($object));
		$accessor = PropertyAccess::createPropertyAccessor();
		foreach($mapping as $fieldName => $propertyPath) {
			$document->addField($fieldName, $accessor->getValue($object, $propertyPath));
		}
		return true;
	}
Fills the given document based on the object

@param Document $document
@param object $object
@return boolean