1, 'firstname' => 'Arthur', 'lastname' => 'Dent', 'gln' => 7653298712357, // 'gln' => 7653298712358, // GLN with valid checksum 'email' => 'dear@example.com', 'username' => 'ardente' ]); // client $client = new Client([ 'id' => 1, 'firstname' => '', // 'firstname' => 'Ford', 'lastname' => 'Prefect', 'ahv' => 1234, 'birthday' => new Date('12.02.1842'), 'address' => new Address([ 'id' => 1, 'street' => '58 Orionis', 'city' => 'Beteigeuze', 'email' => null, ]), ]); printDMO($owner); dumpValidationErrors($owner->validate(OwnerValidator::getInstance())); printDMO($client); dumpValidationErrors($client->validate(ClientValidator::getInstance())); function printDMO(DomainObject $dmo, int $level = 1) { echo "".get_class($dmo)."\n"; echo "
\n"; foreach ($dmo as $field => $value) { // display missing if ValueObject->__toString() is empty if ((string)$value === '') $value = '__ missing __'; // output fieldname and value echo "
$field:
$value
\n"; // recursive print DMOs .. will obviously not work on self reference .. if ($value instanceOf DomainObject) { $level++; printDMO($value, $level); $level--; } } echo "
\n"; } function dumpValidationErrors(bool|ResultCollection $validationResult) { if ($validationResult !== true) { echo "
Validation Errors:\n
";
		var_dump($validationResult);
		echo '

'; } }