Message
API reference › Model › Exception › Message
Represents reusable error message templates for model exceptions.
Use Message::getMessage() to format template values via sprintf() placeholders.
| Case | Value | Description |
|---|---|---|
CAST_SEPARATOR_EMPTY | 'Cast separator cannot be empty.' | Indicates an empty Cast separator. |
CAST_TARGET_EMPTY | 'Cast target cannot be empty.' | Indicates an empty Cast target. |
COLLECTOR_MODEL_CLASS_MISMATCH | "Cannot rebind collector for '%s' to model of class '%s'." | Indicates an attempt to reuse collector metadata with a different model class. |
DUPLICATE_MAP_FROM_KEY | "Duplicate MapFrom key '%s' in '%s::%s' and '%s::%s'." | Indicates duplicate input-key mapping across model properties. |
INVALID_CAST_CLASS | "Cast target '%s' for '%s::%s' must implement '%s'." | Indicates cast class does not implement required caster contract. |
INVALID_CAST_TARGET | "Invalid Cast target '%s' for '%s::%s'." | Indicates unsupported cast target for a model property. |
INVALID_DATE_TIME_STRING | "Invalid date/time string '%s' for type '%s'." | Indicates invalid string input for date/time object casting. |
MAP_FROM_KEY_EMPTY | 'MapFrom key cannot be empty.' | Indicates an empty MapFrom input key. |
READONLY_PROPERTY_ALREADY_INITIALIZED | "Cannot overwrite initialized readonly property: '%s::%s'." | Indicates attempts to overwrite an initialized readonly property. |
UNDEFINED_PROPERTY | "Undefined property: '%s'." | Indicates an undefined property without model class context. |
UNDEFINED_PROPERTY_WITH_CLASS | "Undefined property: '%s::%s'." | Indicates an undefined property including model class context. |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
getMessage() | Returns the formatted message string for the error case. | Message |
Method details
Section titled “Method details”getMessage()
Section titled “getMessage() ”public function getMessage(int|string ...$argument): stringReturns the formatted message string for the error case.
Parameters
| Parameter | Type | Description |
|---|---|---|
...$argument | int| | Values to insert into the message template. |
Returns
string: Formatted error message with interpolated arguments.