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;
    }
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;
    }
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 ; }
Parses an object with SchemaMapper and the given Schema.

@param mixed $entity the object to be parsed

@return array Document
Parses an object with SchemaMapper and the given Schema .