# Google Maps Route Optimization V1 Client - Class FieldReference (0.6.2)

0.6.2 (latest) 0.6.1 0.5.1 0.4.1 0.3.3 0.2.0 0.1.0 Reference documentation and code samples for the Google Maps Route Optimization V1 Client class FieldReference.

Specifies a context for the validation error. A `FieldReference` always
refers to a given field in this file and follows the same hierarchical
structure. For example, we may specify element #2 of `start_time_windows`
of vehicle #5 using:

    name: "vehicles" index: 5 sub_field { name: "end_time_windows" index: 2 }

We however omit top-level entities such as `OptimizeToursRequest` or
`ShipmentModel` to avoid crowding the message.

Generated from protobuf message `google.maps.routeoptimization.v1.OptimizeToursValidationError.FieldReference`

## Namespace

Google \\ Maps \\ RouteOptimization \\ V1 \\ OptimizeToursValidationError

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Name of the field, e.g., "vehicles". |
| `↳ index` | `int` Index of the field if repeated. |
| `↳ key` | `string` Key if the field is a map. |
| `↳ sub_field` | `https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.OptimizeToursValidationError.FieldReference` Recursively nested sub-field, if needed. |

### getName

Name of the field, e.g., "vehicles".

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Name of the field, e.g., "vehicles".

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getIndex

Index of the field if repeated.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### hasIndex

### setIndex

Index of the field if repeated.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getKey

Key if the field is a map.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### hasKey

### setKey

Key if the field is a map.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSubField

Recursively nested sub-field, if needed.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.OptimizeToursValidationError.FieldReference|null` |   |

### hasSubField

### clearSubField

### setSubField

Recursively nested sub-field, if needed.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.OptimizeToursValidationError.FieldReference` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getIndexOrKey

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |