original_string: protected function parseToDocument($entity)
      {
          $schemaMapper = $this->getSchemaMapper();
          $parsedDocument = $schemaMapper->map($entity);
  
          if (is_object($entity)) {
              foreach ($parsedDocument as $field => $value) {
                  $entity->$field = $value;
              }
          }
  
          return $parsedDocument;
      }
code: protected function parseToDocument($entity)
      {
          $schemaMapper = $this->getSchemaMapper();
          $parsedDocument = $schemaMapper->map($entity);
  
          if (is_object($entity)) {
              foreach ($parsedDocument as $field => $value) {
                  $entity->$field = $value;
              }
          }
  
          return $parsedDocument;
      }
code_tokens: protected function parseToDocument ( $ entity ) { $ schemaMapper = $ this -> getSchemaMapper ( ) ; $ parsedDocument = $ schemaMapper -> map ( $ entity ) ; if ( is_object ( $ entity ) ) { foreach ( $ parsedDocument as $ field => $ value ) { $ entity -> $ field = $ value ; } } return $ parsedDocument ; }
docstring: Parses an object with SchemaMapper and the given Schema.
  
  @param mixed $entity the object to be parsed
  
  @return array Document
docstring_tokens: Parses an object with SchemaMapper and the given Schema .