Documentation

Hydratable

Adding this interface to a class will allow it to be automatically bound to properties in the class.

Table of Contents

hydrate()  : bool
Load configuration data into an object structure.

Methods

hydrate()

Load configuration data into an object structure.

public hydrate(string|object|array<string|int, mixed> $config[, array<string|int, mixed>|null $options = [] ]) : bool
Parameters
$config : string|object|array<string|int, mixed>

Configuration data either as a string or the result of decoding a configuration file.

$options : array<string|int, mixed>|null = []

Options are:

  • parent object: A reference to the object containing $target (if any).
  • source string [json]|object|yaml: Format of the data in $config, default json.
  • strict bool [true]: Throw errors on any failure, otherwise log for getErrors().

The application can pass options that begin with an underscore. These will be passed through unchanged.

Tags
throws
HydrationException
Return values
bool

True if all fields passed validation; if in strict mode true when all fields are defined class properties.

Search results