2.2.0 (latest) 2.0.6 1.34.2 1.33.1 1.32.3 1.31.0 1.30.0 1.29.2 1.28.2 1.26.0 1.25.0 1.24.4 1.23.0 1.22.1 1.21.2 1.19.0 1.18.1 1.17.1 Reference documentation and code samples for the Cloud Datastore Client class EntityMapper.

Utility methods for mapping between datastore and [Entity](https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/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](https://docs.cloud.google.com/php/docs/reference/cloud-core/latest/Int64.html) object for 32 bit platform compatibility. |

### 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 [EntityInterface](https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/EntityInterface). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `array` |   |

### objectToRequest

Translate an Entity to a datastore representation.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `entity` | `https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/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'