Result
class Result (View source)
Result object for operations dealing with objects, such as the Property Mapper or the Validators.
Properties
protected Error[] | $errors | ||
protected bool | $errorsExist | Caches the existence of errors |
|
protected Warning[] | $warnings | ||
protected bool | $warningsExist | Caches the existence of warning |
|
protected Notice[] | $notices | ||
protected bool | $noticesExist | Caches the existence of notices |
|
protected Result[] | $propertyResults | The result objects for the sub properties |
|
protected Result | $parent |
Methods
Get all errors in the current Result object (non-recursive)
Get all warnings in the current Result object (non-recursive)
Get all notices in the current Result object (non-recursive)
Get the first error object of the current Result object (non-recursive)
Get the first warning object of the current Result object (non-recursive)
Get the first notice object of the current Result object (non-recursive)
Return a Result object for the given property path. This is a fluent interface, so you will probably use it like: $result->forProperty('foo.bar')->getErrors() -- to get all errors for property "foo.bar"
Internal use only!
Does the current Result object have Errors? (Recursively)
Sets the error cache to true and propagates the information upwards the Result-Object Tree
Does the current Result object have Warnings? (Recursively)
Sets the warning cache to true and propagates the information upwards the Result-Object Tree
Does the current Result object have Notices? (Recursively)
Sets the notices cache to true and propagates the information upwards the Result-Object Tree
Does the current Result object have Notices, Errors or Warnings? (Recursively)
Get a list of all Error objects recursively. The result is an array, where the key is the property path where the error occurred, and the value is a list of all errors (stored as array)
Get a list of all Error objects recursively. The result is an array, where the key is the property path where the error occurred, and the value is a list of all errors (stored as array)
Get a list of all Warning objects recursively. The result is an array, where the key is the property path where the warning occurred, and the value is a list of all warnings (stored as array)
Get a list of all Notice objects recursively. The result is an array, where the key is the property path where the notice occurred, and the value is a list of all notices (stored as array)
Flatten a tree of Result objects, based on a certain property.
No description
Merge a single property from the other result object.
Get a list of all sub Result objects available.
Clears the result
Details
void
setParent(Result $parent)
Injects the parent result and propagates the cached error states upwards
void
addError(Error $error)
Add an error to the current Result object
void
addWarning(Warning $warning)
Add a warning to the current Result object
void
addNotice(Notice $notice)
Add a notice to the current Result object
array
getErrors(string $messageTypeFilter = null)
Get all errors in the current Result object (non-recursive)
array
getWarnings(string $messageTypeFilter = null)
Get all warnings in the current Result object (non-recursive)
array
getNotices(string $messageTypeFilter = null)
Get all notices in the current Result object (non-recursive)
Error
getFirstError(string $messageTypeFilter = null)
Get the first error object of the current Result object (non-recursive)
Warning
getFirstWarning(string $messageTypeFilter = null)
Get the first warning object of the current Result object (non-recursive)
Notice
getFirstNotice(string $messageTypeFilter = null)
Get the first notice object of the current Result object (non-recursive)
Result
forProperty(string $propertyPath = null)
Return a Result object for the given property path. This is a fluent interface, so you will probably use it like: $result->forProperty('foo.bar')->getErrors() -- to get all errors for property "foo.bar"
Result
recurseThroughResult(array $pathSegments)
Internal use only!
bool
hasErrors()
Does the current Result object have Errors? (Recursively)
protected void
setErrorsExist()
Sets the error cache to true and propagates the information upwards the Result-Object Tree
bool
hasWarnings()
Does the current Result object have Warnings? (Recursively)
protected void
setWarningsExist()
Sets the warning cache to true and propagates the information upwards the Result-Object Tree
bool
hasNotices()
Does the current Result object have Notices? (Recursively)
protected void
setNoticesExist()
Sets the notices cache to true and propagates the information upwards the Result-Object Tree
bool
hasMessages()
Does the current Result object have Notices, Errors or Warnings? (Recursively)
array
getFlattenedErrors()
Get a list of all Error objects recursively. The result is an array, where the key is the property path where the error occurred, and the value is a list of all errors (stored as array)
array
getFlattenedErrorsOfType(string $type)
Get a list of all Error objects recursively. The result is an array, where the key is the property path where the error occurred, and the value is a list of all errors (stored as array)
array
getFlattenedWarnings()
Get a list of all Warning objects recursively. The result is an array, where the key is the property path where the warning occurred, and the value is a list of all warnings (stored as array)
array
getFlattenedNotices()
Get a list of all Notice objects recursively. The result is an array, where the key is the property path where the notice occurred, and the value is a list of all notices (stored as array)
void
flattenTree(string $propertyName, array $result, array $level = [], string $messageTypeFilter = null)
Flatten a tree of Result objects, based on a certain property.
protected array
filterMessages(array $messages, string $messageTypeFilter = null)
No description
void
merge(Result $otherResult)
Merge the given Result object into this one.
protected void
mergeProperty(Result $otherResult, string $getterName, string $adderName)
Merge a single property from the other result object.
array
getSubResults()
Get a list of all sub Result objects available.
void
clear()
Clears the result