Schema
Schema
class Schema extends \Hazaar\Model\Struct implements \Hazaar\Model\Interface\CollectsValidationErrorsExtends: Hazaar\Model\Struct
Implements: Hazaar\Model\Interface\CollectsValidationErrors
Properties
validationErrors
Kept private: Struct::initialise() only reflects protected/public properties, so a
private array $validationErrorsType: array
protected $validationErrors both leaks into every subclass's serialized output (toArray()/ jsonSerialize()) as permanently-empty noise, and is settable by whatever data a subclass is constructed from (e.g. a request body containing a validationErrors key).
Methods
addValidationError
Adds a validation error for a specific field.
public addValidationError(string $field, PropertyException $e): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$field | string | the name of the field with the validation error |
$e | Hazaar\Model\Exception\PropertyException | the exception representing the validation error |
getValidationErrors
Retrieves all validation errors for the schema.
public getValidationErrors(): arrayReturns: array
validate
Validates the schema and checks if there are any validation errors.
public validate(): boolReturns: bool
set
Sets the value of a property, adding a validation error if an exception occurs.
public set(string $name, mixed $value): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$name | string | the name of the property to set |
$value | mixed | the value to set for the property |
initialise
Struct initializer.
public initialise(mixed $data, mixed $constructorArgs): voidReturns: void
Errors during initialization will throw PropertyException exceptions immediately.
Parameters
| Parameter | Type | Description |
|---|---|---|
$data | mixed | the data to initialize the model with |
$constructorArgs | mixed |
Generated by Hazaar API Doc Generator on Fri, 04 Sep 2026 23:32:17 +0000