# Data Loss Prevention V2 Client - Class FieldTransformation (2.13.0)

2.13.0 (latest) 2.12.0 2.11.0 2.10.0 2.9.2 2.8.1 2.7.0 2.6.1 2.4.1 2.3.0 2.2.3 2.1.0 2.0.0 1.19.0 1.18.0 1.17.0 1.16.0 1.15.1 1.14.0 1.13.2 1.12.0 1.11.0 1.10.2 1.9.0 1.8.6 Reference documentation and code samples for the Data Loss Prevention V2 Client class FieldTransformation.

The transformation to apply to the field.

Generated from protobuf message `google.privacy.dlp.v2.FieldTransformation`

## Namespace

Google \\ Cloud \\ Dlp \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ fields` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.FieldId>` Required. Input field(s) to apply the transformation to. When you have columns that reference their position within a list, omit the index from the FieldId. FieldId name matching ignores the index. For example, instead of "contact.nums\[0\].type", use "contact.nums.type". |
| `↳ condition` | `https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.RecordCondition` Only apply the transformation if the condition evaluates to true for the given `RecordCondition`. The conditions are allowed to reference fields that are not used in the actual transformation. Example Use Cases: - Apply a different bucket transformation to an age column if the zip code column for the same record is within a specific range. - Redact a field if the date of birth field is greater than 85. |
| `↳ primitive_transformation` | `https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.PrimitiveTransformation` Apply the transformation to the entire field. |
| `↳ info_type_transformations` | `https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.InfoTypeTransformations` Treat the contents of the field as free text, and selectively transform content that matches an `InfoType`. |

### getFields

Required. Input field(s) to apply the transformation to.

When you have columns that reference their position within a list,
omit the index from the FieldId. FieldId name matching ignores the index.
For example, instead of "contact.nums\[0\].type", use "contact.nums.type".

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.FieldId>` |   |

### setFields

Required. Input field(s) to apply the transformation to.

When you have columns that reference their position within a list,
omit the index from the FieldId. FieldId name matching ignores the index.
For example, instead of "contact.nums\[0\].type", use "contact.nums.type".

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.FieldId>` |

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

### getCondition

Only apply the transformation if the condition evaluates to true for the
given `RecordCondition`. The conditions are allowed to reference fields
that are not used in the actual transformation.

Example Use Cases:

- Apply a different bucket transformation to an age column if the zip code column for the same record is within a specific range.
- Redact a field if the date of birth field is greater than 85.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.RecordCondition|null` |   |

### hasCondition

### clearCondition

### setCondition

Only apply the transformation if the condition evaluates to true for the
given `RecordCondition`. The conditions are allowed to reference fields
that are not used in the actual transformation.

Example Use Cases:

- Apply a different bucket transformation to an age column if the zip code column for the same record is within a specific range.
- Redact a field if the date of birth field is greater than 85.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.RecordCondition` |

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

### getPrimitiveTransformation

Apply the transformation to the entire field.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.PrimitiveTransformation|null` |   |

### hasPrimitiveTransformation

### setPrimitiveTransformation

Apply the transformation to the entire field.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.PrimitiveTransformation` |

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

### getInfoTypeTransformations

Treat the contents of the field as free text, and selectively
transform content that matches an `InfoType`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.InfoTypeTransformations|null` |   |

### hasInfoTypeTransformations

### setInfoTypeTransformations

Treat the contents of the field as free text, and selectively
transform content that matches an `InfoType`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.InfoTypeTransformations` |

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

### getTransformation

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