# Message

> Defines soft-delete exception message templates.

[API reference](/docs/api/index.md) › [Soft Delete](/docs/extensions/soft-delete/reference/index.md) › [exception](/docs/extensions/soft-delete/reference/exception/index.md) › Message

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

Defines soft-delete exception message templates.

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

## Cases

| Case | Value | Description |
| --- | --- | --- |
| <span id="case-ALLOW_DELETE_CALLBACK_INVALID"></span>`ALLOW_DELETE_CALLBACK_INVALID` | `"'allowDeleteCallback' must be 'callable' and return a 'boolean'."` | Error when the delete callback is not callable or does not return a boolean. |
| <span id="case-COMPUTED_MARKER_REQUIRES_DELETED_CONDITION"></span>`COMPUTED_MARKER_REQUIRES_DELETED_CONDITION` | `"'deletedCondition' must be configured for a computed marker " . 'with a non-null active value.'` | Error when a computed soft-delete marker has a non-null restore value and no explicit deleted condition. |
| <span id="case-COMPUTED_RESTORE_VALUE_REQUIRES_NOT_DELETED_CONDITION"></span>`COMPUTED_RESTORE_VALUE_REQUIRES_NOT_DELETED_CONDITION` | `"'notDeletedCondition' must be configured when " . 'restore values are computed.'` | Error when a restore value is computed and no explicit not-deleted condition is configured. |
| <span id="case-CONDITION_OPERATOR_MUST_BE_STRING"></span>`CONDITION_OPERATOR_MUST_BE_STRING` | `"Soft-delete condition operator must be a 'string'."` | Error when a soft-delete condition operator is not a string. |
| <span id="case-DELETE_BEHAVIOR_REQUIRES_ACTIVE_RECORD_OWNER"></span>`DELETE_BEHAVIOR_REQUIRES_ACTIVE_RECORD_OWNER` | `"'DeleteBehavior' requires a 'BaseActiveRecord' owner."` | Error when the soft-delete behavior is not attached to an ActiveRecord. |
| <span id="case-DELETE_FALLBACK_EXCEPTION_INVALID"></span>`DELETE_FALLBACK_EXCEPTION_INVALID` | `"'deleteFallbackException' must name a 'Throwable' type."` | Error when the delete fallback exception does not name a throwable type. |
| <span id="case-DELETED_OBJECT_OUTDATED"></span>`DELETED_OBJECT_OUTDATED` | `'The object being deleted is outdated.'` | Error when the optimistic lock no longer matches the row being deleted. |
| <span id="case-FILTER_VALUE_UNKNOWN"></span>`FILTER_VALUE_UNKNOWN` | `'Unknown soft-delete filter value.'` | Error when a soft-delete filter value is not one of the accepted values. |
| <span id="case-HOOK_MUST_BE_PUBLIC"></span>`HOOK_MUST_BE_PUBLIC` | `"ActiveRecord hook '%s' must be public."` | Error when an owner hook is declared with a visibility other than public. |
| <span id="case-OPTIMISTIC_LOCK_CANNOT_BE_INCREMENTED"></span>`OPTIMISTIC_LOCK_CANNOT_BE_INCREMENTED` | `'Optimistic lock value cannot be incremented.'` | Error when the optimistic lock value cannot be incremented. |
| <span id="case-OPTIMISTIC_LOCK_MUST_BE_NON_NEGATIVE_INTEGER"></span>`OPTIMISTIC_LOCK_MUST_BE_NON_NEGATIVE_INTEGER` | `"Optimistic lock value must be a non-negative 'integer'."` | Error when the optimistic lock value is not a non-negative integer. |
| <span id="case-PERSISTED_PRIMARY_KEY_REQUIRED"></span>`PERSISTED_PRIMARY_KEY_REQUIRED` | `'Persisted primary key is required for deletion or restoration.'` | Error when the record has no complete persisted primary key. |
| <span id="case-QUERY_BEHAVIOR_REQUIRES_ACTIVE_QUERY_OWNER"></span>`QUERY_BEHAVIOR_REQUIRES_ACTIVE_QUERY_OWNER` | `"'QueryBehavior' requires a SQL 'ActiveQuery' owner."` | Error when the query behavior is not attached to a SQL ActiveQuery. |
| <span id="case-QUERY_MODEL_MUST_EXTEND_BASE_ACTIVE_RECORD"></span>`QUERY_MODEL_MUST_EXTEND_BASE_ACTIVE_RECORD` | `"The query model must extend 'BaseActiveRecord'."` | Error when the query model does not extend BaseActiveRecord. |
| <span id="case-QUERY_MODEL_MUST_HAVE_DELETE_BEHAVIOR"></span>`QUERY_MODEL_MUST_HAVE_DELETE_BEHAVIOR` | `"The query model must have a 'DeleteBehavior'."` | Error when the query model has no soft-delete behavior. |
| <span id="case-RESTORE_ATTRIBUTE_VALUES_NOT_INFERABLE"></span>`RESTORE_ATTRIBUTE_VALUES_NOT_INFERABLE` | `'Unable to determine restore attribute values automatically; ' . "'%s::restoreAttributeValues' must be set explicitly."` | Error when the restore values cannot be inferred from the soft-delete values. |
| <span id="case-ROLLBACK_FAILED"></span>`ROLLBACK_FAILED` | `"Unable to complete rollback; '%s'."` | Error when a rollback fails after the exception that caused it. |
| <span id="case-SAFE_DELETE_REQUIRES_ACTIVE_RECORD"></span>`SAFE_DELETE_REQUIRES_ACTIVE_RECORD` | `"'safeDelete()' requires a SQL 'ActiveRecord' owner."` | Error when a safe delete is requested on a record that is not a SQL ActiveRecord. |
| <span id="case-TRANSACTION_REQUIRES_SQL_CONNECTION"></span>`TRANSACTION_REQUIRES_SQL_CONNECTION` | `"Transactional soft delete or restore requires a Yii SQL 'Connection'."` | Error when a transactional operation runs on an owner without a Yii SQL connection. |
| <span id="case-UPDATED_OBJECT_OUTDATED"></span>`UPDATED_OBJECT_OUTDATED` | `'The object being updated is outdated.'` | Error when the optimistic lock no longer matches the row being updated. |

## 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`