Cloud Datastore Client - Class EntityMapper (1.31.0)

Reference documentation and code samples for the Cloud Datastore Client class EntityMapper.

Utility methods for mapping between datastore and Google\Cloud\Datastore\Entity.

Namespace

Google \ Cloud \ Datastore

Methods

__construct

Create an Entity Mapper

Parameters
Name Description
projectId string

The datastore project ID

encode bool

Whether to encode blobs as base64.

returnInt64AsObject bool

If true, 64 bit integers will be returned as a Google\Cloud\Core\Int64 object for 32 bit platform compatibility.

connectionType string

[optional] The connection type of the client. Can be rest or grpc, defaults to grpc.

responseToEntityProperties

Convert an entity response to properties, excludes and meanings.

Parameters
Name Description
entityData array

The incoming entity

className string

The name of a class to use as the entity. Must implement Google\Cloud\Datastore\EntityInterface.

Returns
Type Description
array

objectToRequest

Translate an Entity to a datastore representation.

Parameter
Name Description
entity Google\Cloud\Datastore\EntityInterface

The input entity.

Returns
Type Description
array A Datastore [Entity](https://cloud.google.com/datastore/reference/rest/v1/Entity)

convertValue

Convert a Datastore value object to a simple value

Parameters
Name Description
type string

The value type

value mixed

The value

className string

[optional] The object type to decode to, if type is entityValue.

Returns
Type Description
mixed

valueObject

Format values for the API

Parameters
Name Description
value mixed
exclude bool

[optional] If true, value will be excluded from datastore indexes.

meaning int

[optional] The Meaning value. Maintained only for backwards compatibility.

Returns
Type Description
array

objectProperty

Convert different object types to API values

Parameter
Name Description
value mixed

The value object

Returns
Type Description
array

Constants

DATE_FORMAT

Value: 'Y-m-d\\TH:i:s.uP'

DATE_FORMAT_NO_MS

Value: 'Y-m-d\\TH:i:sP'