Result

Result object for operations dealing with objects, such as the Property Mapper or the Validators.

Table of Contents

Properties

$errors  : array<string|int, Error>
$errorsExist  : bool
Caches the existence of errors
$notices  : array<string|int, Notice>
$noticesExist  : bool
Caches the existence of notices
$parent  : Result
$propertyResults  : array<string|int, Result>
The result objects for the sub properties
$warnings  : array<string|int, Warning>
$warningsExist  : bool
Caches the existence of warning

Methods

addError()  : void
Add an error to the current Result object
addNotice()  : void
Add a notice to the current Result object
addWarning()  : void
Add a warning to the current Result object
clear()  : void
Clears the result
forProperty()  : Result
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"
getErrors()  : array<string|int, Error>
Get all errors in the current Result object (non-recursive)
getFirstError()  : bool|Error
Get the first error object of the current Result object (non-recursive)
getFirstNotice()  : bool|Notice
Get the first notice object of the current Result object (non-recursive)
getFirstWarning()  : bool|Warning
Get the first warning object of the current Result object (non-recursive)
getFlattenedErrors()  : array<string, array<string|int, Error>>
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)
getFlattenedNotices()  : array<string, array<string|int, Notice>>
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)
getFlattenedWarnings()  : array<string, array<string|int, Warning>>
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)
getNotices()  : array<string|int, Notice>
Get all notices in the current Result object (non-recursive)
getSubResults()  : array<string|int, Result>
Get a list of all sub Result objects available.
getWarnings()  : array<string|int, Warning>
Get all warnings in the current Result object (non-recursive)
hasErrors()  : bool
Does the current Result object have Errors? (Recursively)
hasMessages()  : bool
Does the current Result object have Notices, Errors or Warnings? (Recursively)
hasNotices()  : bool
Does the current Result object have Notices? (Recursively)
hasWarnings()  : bool
Does the current Result object have Warnings? (Recursively)
merge()  : void
Merge the given Result object into this one.
recurseThroughResult()  : Result
setParent()  : void
Injects the parent result and propagates the cached error states upwards
flattenErrorTree()  : void
flattenNoticesTree()  : void
flattenWarningsTree()  : void
mergeProperty()  : void
Merge a single property from the other result object.
setErrorsExist()  : void
Sets the error cache to TRUE and propagates the information upwards the Result-Object Tree
setNoticesExist()  : void
Sets the notices cache to TRUE and propagates the information upwards the Result-Object Tree
setWarningsExist()  : void
Sets the warning cache to TRUE and propagates the information upwards the Result-Object Tree

Properties

$errorsExist

Caches the existence of errors

protected bool $errorsExist = false

$noticesExist

Caches the existence of notices

protected bool $noticesExist = false

$propertyResults

The result objects for the sub properties

protected array<string|int, Result> $propertyResults = []

$warningsExist

Caches the existence of warning

protected bool $warningsExist = false

Methods

addError()

Add an error to the current Result object

public addError(Error $error) : void
Parameters
$error : Error

addNotice()

Add a notice to the current Result object

public addNotice(Notice $notice) : void
Parameters
$notice : Notice

addWarning()

Add a warning to the current Result object

public addWarning(Warning $warning) : void
Parameters
$warning : Warning

clear()

Clears the result

public clear() : void

forProperty()

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"

public forProperty(string|null $propertyPath) : Result
Parameters
$propertyPath : string|null
Return values
Result

getErrors()

Get all errors in the current Result object (non-recursive)

public getErrors() : array<string|int, Error>
Return values
array<string|int, Error>

getFirstError()

Get the first error object of the current Result object (non-recursive)

public getFirstError() : bool|Error
Return values
bool|Error

getFirstNotice()

Get the first notice object of the current Result object (non-recursive)

public getFirstNotice() : bool|Notice
Return values
bool|Notice

getFirstWarning()

Get the first warning object of the current Result object (non-recursive)

public getFirstWarning() : bool|Warning
Return values
bool|Warning

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)

public getFlattenedErrors() : array<string, array<string|int, Error>>
Return values
array<string, array<string|int, Error>>

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)

public getFlattenedNotices() : array<string, array<string|int, Notice>>
Return values
array<string, array<string|int, Notice>>

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)

public getFlattenedWarnings() : array<string, array<string|int, Warning>>
Return values
array<string, array<string|int, Warning>>

getNotices()

Get all notices in the current Result object (non-recursive)

public getNotices() : array<string|int, Notice>
Return values
array<string|int, Notice>

getSubResults()

Get a list of all sub Result objects available.

public getSubResults() : array<string|int, Result>
Return values
array<string|int, Result>

getWarnings()

Get all warnings in the current Result object (non-recursive)

public getWarnings() : array<string|int, Warning>
Return values
array<string|int, Warning>

hasErrors()

Does the current Result object have Errors? (Recursively)

public hasErrors() : bool
Return values
bool

hasMessages()

Does the current Result object have Notices, Errors or Warnings? (Recursively)

public hasMessages() : bool
Return values
bool

hasNotices()

Does the current Result object have Notices? (Recursively)

public hasNotices() : bool
Return values
bool

hasWarnings()

Does the current Result object have Warnings? (Recursively)

public hasWarnings() : bool
Return values
bool

merge()

Merge the given Result object into this one.

public merge(Result $otherResult) : void
Parameters
$otherResult : Result

recurseThroughResult()

public recurseThroughResult(array<string|int, mixed> $pathSegments) : Result
Parameters
$pathSegments : array<string|int, mixed>
Internal

only to be used within Extbase, not part of TYPO3 Core API.

Tags
todo:

consider making this method protected as it will and should not be called from an outside scope

Return values
Result

setParent()

Injects the parent result and propagates the cached error states upwards

public setParent(Result $parent) : void
Parameters
$parent : Result

flattenErrorTree()

protected flattenErrorTree(array<string|int, mixed> &$result, array<string|int, mixed> $level) : void
Parameters
$result : array<string|int, mixed>
$level : array<string|int, mixed>

flattenNoticesTree()

protected flattenNoticesTree(array<string|int, mixed> &$result, array<string|int, mixed> $level) : void
Parameters
$result : array<string|int, mixed>
$level : array<string|int, mixed>

flattenWarningsTree()

protected flattenWarningsTree(array<string|int, mixed> &$result, array<string|int, mixed> $level) : void
Parameters
$result : array<string|int, mixed>
$level : array<string|int, mixed>

mergeProperty()

Merge a single property from the other result object.

protected mergeProperty(Result $otherResult, string $getterName, string $adderName) : void
Parameters
$otherResult : Result
$getterName : string
$adderName : string

setErrorsExist()

Sets the error cache to TRUE and propagates the information upwards the Result-Object Tree

protected setErrorsExist() : void

setNoticesExist()

Sets the notices cache to TRUE and propagates the information upwards the Result-Object Tree

protected setNoticesExist() : void

setWarningsExist()

Sets the warning cache to TRUE and propagates the information upwards the Result-Object Tree

protected setWarningsExist() : void

        
On this page

Search results