Cloud Datastore Client - Class EntityMapper (1.17.1)

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

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

Methods

__construct

Create an Entity Mapper

Parameters
NameDescription
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 {@see} object for 32 bit platform compatibility.

responseToEntityProperties

Convert an entity response to properties, excludes and meanings.

Parameters
NameDescription
entityData array

The incoming entity

className string

The name of a class to use as the entity. Must implement {@see}.

Returns
TypeDescription
array

objectToRequest

Translate an Entity to a datastore representation.

Parameter
NameDescription
entity Google\Cloud\Datastore\EntityInterface

The input entity.

Returns
TypeDescription
arrayA Datastore [Entity](https://cloud.google.com/datastore/reference/rest/v1/Entity)

convertValue

Convert a Datastore value object to a simple value

Parameters
NameDescription
type string

The value type

value mixed

The value

className string

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

Returns
TypeDescription
mixed

valueObject

Format values for the API

Parameters
NameDescription
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
TypeDescription
array

objectProperty

Convert different object types to API values

Parameter
NameDescription
value mixed

The value object

Returns
TypeDescription
array

Constants

DATE_FORMAT

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

DATE_FORMAT_NO_MS

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