public function transform($object, array $fields)
    {
        $identifier = $this->propertyAccessor->getValue($object, $this->options['identifier']);
        if ($identifier && !is_scalar($identifier)) {
            $identifier = (string) $identifier;
        }

        return $this->transformObjectToDocument($object, $fields, $identifier);
    }
public function transform($object, array $fields)
    {
        $identifier = $this->propertyAccessor->getValue($object, $this->options['identifier']);
        if ($identifier && !is_scalar($identifier)) {
            $identifier = (string) $identifier;
        }

        return $this->transformObjectToDocument($object, $fields, $identifier);
    }
public function transform ( $ object , array $ fields ) { $ identifier = $ this -> propertyAccessor -> getValue ( $ object , $ this -> options [ 'identifier' ] ) ; if ( $ identifier && ! is_scalar ( $ identifier ) ) { $ identifier = ( string ) $ identifier ; } return $ this -> transformObjectToDocument ( $ object , $ fields , $ identifier ) ; }
Transforms an object into an elastica object having the required keys.

@param object $object the object to convert
@param array  $fields the keys we want to have in the returned array

@return Document
Transforms an object into an elastica object having the required keys .