# Message

> Defines LDAP exception message templates.

[API reference](/docs/api/index.md) › [LDAP](/docs/extensions/ldap/reference/index.md) › [exception](/docs/extensions/ldap/reference/exception/index.md) › Message

| enum | `yii2\extensions\ldap\exception\Message` |
| --- | --- |
| Backed by | `string` |
| Source | [`src/exception/Message.php`](https://github.com/yii2-extensions/ldap/blob/main/src/exception/Message.php#L14) |

Defines LDAP exception message templates.

Use [`Message::getMessage()`](/docs/extensions/ldap/reference/exception/message/index.md#method-getMessage) to format the template with `sprintf()` arguments.

## Cases

| Case | Value | Description |
| --- | --- | --- |
| <span id="case-CONNECTION_MANAGER_CHANGED"></span>`CONNECTION_MANAGER_CHANGED` | `'Unregister this directory before changing the LDAP connection manager.'` | Error when the LdapRecord connection manager changed while this directory still owns registrations. |
| <span id="case-CONNECTION_NAME_ALREADY_REGISTERED"></span>`CONNECTION_NAME_ALREADY_REGISTERED` | `'An LDAP connection with this name is already registered.'` | Error when another component already registered the connection name. |
| <span id="case-CONNECTION_NAME_INVALID"></span>`CONNECTION_NAME_INVALID` | `'Specify a valid LDAP connection name.'` | Error when a connection name is not a string of letters, digits, underscores or hyphens starting with a letter. |
| <span id="case-DIRECTORY_UNAVAILABLE"></span>`DIRECTORY_UNAVAILABLE` | `'The directory operation could not be completed.'` | Error when a directory operation fails; it carries no backend diagnostics or credentials. |
| <span id="case-ENDPOINT_INVALID"></span>`ENDPOINT_INVALID` | `'Specify a valid LDAP endpoint, base DN, and service-account credentials.'` | Error when the host, port, timeout, base DN, credentials or writable flag of an endpoint is invalid. |
| <span id="case-ENDPOINT_MUST_BE_ARRAY"></span>`ENDPOINT_MUST_BE_ARRAY` | `'Specify LDAP endpoint settings as an array.'` | Error when the settings of a connection are not an array. |
| <span id="case-LDAP_ATTRIBUTE_NAME_INVALID"></span>`LDAP_ATTRIBUTE_NAME_INVALID` | `'Map only explicit LDAP attribute names.'` | Error when a synchronization mapping names something other than one explicit LDAP attribute. |
| <span id="case-MEMBERSHIP_MODELS_INVALID"></span>`MEMBERSHIP_MODELS_INVALID` | `'Use persisted models of the same schema on an enabled LDAP write connection.'` | Error when the group and user are not persisted models of one schema on a writable connection. |
| <span id="case-MEMBERSHIP_MODELS_NOT_ON_WRITE_CONNECTION"></span>`MEMBERSHIP_MODELS_NOT_ON_WRITE_CONNECTION` | `'The models must resolve to the registered LDAP write connection.'` | Error when the group or user resolves to a connection other than the registered write connection. |
| <span id="case-SYNC_SOURCE_INVALID"></span>`SYNC_SOURCE_INVALID` | `'Sync requires a mapped user query on a named LDAP read connection and a positive ' . 'page size.'` | Error when the synchronization query, mapping or page size is invalid. |
| <span id="case-VERIFIER_HOST_INVALID"></span>`VERIFIER_HOST_INVALID` | `'Specify one LDAP hostname without a scheme or port.'` | Error when the password verifier host is not a bare hostname. |
| <span id="case-VERIFIER_PORT_OR_TIMEOUT_INVALID"></span>`VERIFIER_PORT_OR_TIMEOUT_INVALID` | `'Specify a valid LDAP port and a positive network timeout.'` | Error when the password verifier port or timeout is out of range. |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`getMessage()`](#method-getMessage) | Returns the formatted message string for the error case. | `Message` |

## Method details

### getMessage() <span id="method-getMessage"></span>

```php
public function getMessage(int|string ...$argument): string
```

Returns the formatted message string for the error case.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `...$argument` | `int\|string` | Values to insert into the message template. |

**Returns**

`string`