Cloud Datastore Client - Class EntityMapper (1.23.0) Stay organized with collections Save and categorize content based on your preferences.
Reference documentation and code samples for the Cloud Datastore Client class EntityMapper.
Utility methods for mapping between datastore andGoogle\Cloud\Datastore\Entity.
Namespace
Google \ Cloud \ DatastoreMethods
__construct
Create an Entity Mapper
| Parameters | |
|---|---|
| Name | Description |
projectId | stringThe datastore project ID |
encode | boolWhether to encode blobs as base64. |
returnInt64AsObject | boolIf true, 64 bit integers will bereturned as aGoogle\Cloud\Datastore\Google\Cloud\Core\Int64 object for 32 bitplatform compatibility. |
responseToEntityProperties
Convert an entity response to properties, excludes and meanings.
| Parameters | |
|---|---|
| Name | Description |
entityData | arrayThe incoming entity |
className | stringThe name of a class to use as the entity. MustimplementGoogle\Cloud\Datastore\Google\Cloud\Datastore\EntityInterface. |
| Returns | |
|---|---|
| Type | Description |
array | |
objectToRequest
Translate an Entity to a datastore representation.
| Parameter | |
|---|---|
| Name | Description |
entity | Google\Cloud\Datastore\EntityInterfaceThe 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 | stringThe value type |
value | mixedThe 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 | mixedThe 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'Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-01-24 UTC.