‪TYPO3CMS  11.5
TYPO3\CMS\Extbase\Error\Result Class Reference

Public Member Functions

 setParent (Result $parent)
 
 addError (Error $error)
 
 addWarning (Warning $warning)
 
 addNotice (Notice $notice)
 
Error[] getErrors ()
 
Warning[] getWarnings ()
 
Notice[] getNotices ()
 
bool Error getFirstError ()
 
bool Warning getFirstWarning ()
 
bool Notice getFirstNotice ()
 
Result forProperty (?string $propertyPath)
 
Result recurseThroughResult (array $pathSegments)
 
bool hasMessages ()
 
 clear ()
 
bool hasErrors ()
 
bool hasWarnings ()
 
bool hasNotices ()
 
array< string, array< Error > > getFlattenedErrors ()
 
array< string, array< Warning > > getFlattenedWarnings ()
 
array< string, array< Notice > > getFlattenedNotices ()
 
 merge (Result $otherResult)
 
Result[] getSubResults ()
 

Protected Member Functions

 setErrorsExist ()
 
 setWarningsExist ()
 
 setNoticesExist ()
 
 flattenErrorTree (array &$result, array $level)
 
 flattenWarningsTree (array &$result, array $level)
 
 flattenNoticesTree (array &$result, array $level)
 
 mergeProperty (Result $otherResult, string $getterName, string $adderName)
 

Protected Attributes

Error[] $errors = array( )
 
bool $errorsExist = false
 
Warning[] $warnings = array( )
 
bool $warningsExist = false
 
Notice[] $notices = array( )
 
bool $noticesExist = false
 
Result[] $propertyResults = array( )
 
Result $parent
 

Detailed Description

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

Definition at line 23 of file Result.php.

Member Function Documentation

◆ addError()

TYPO3\CMS\Extbase\Error\Result::addError ( Error  $error)

Add an error to the current Result object

Parameters
Error$error

Definition at line 89 of file Result.php.

References TYPO3\CMS\Extbase\Error\Result\setErrorsExist().

Referenced by TYPO3\CMS\FrontendLogin\Controller\PasswordRecoveryController\validateNewPassword().

◆ addNotice()

TYPO3\CMS\Extbase\Error\Result::addNotice ( Notice  $notice)

Add a notice to the current Result object

Parameters
Notice$notice

Definition at line 111 of file Result.php.

References TYPO3\CMS\Extbase\Error\Result\setNoticesExist().

◆ addWarning()

TYPO3\CMS\Extbase\Error\Result::addWarning ( Warning  $warning)

Add a warning to the current Result object

Parameters
Warning$warning

Definition at line 100 of file Result.php.

References TYPO3\CMS\Extbase\Error\Result\setWarningsExist().

◆ clear()

TYPO3\CMS\Extbase\Error\Result::clear ( )

Clears the result

Definition at line 277 of file Result.php.

◆ flattenErrorTree()

TYPO3\CMS\Extbase\Error\Result::flattenErrorTree ( array &  $result,
array  $level 
)
protected
Parameters
array$result
array$level

Definition at line 396 of file Result.php.

References TYPO3\CMS\Extbase\Error\Result\$errors.

Referenced by TYPO3\CMS\Extbase\Error\Result\getFlattenedErrors().

◆ flattenNoticesTree()

TYPO3\CMS\Extbase\Error\Result::flattenNoticesTree ( array &  $result,
array  $level 
)
protected
Parameters
array$result
array$level

Definition at line 428 of file Result.php.

References TYPO3\CMS\Extbase\Error\Result\$notices.

Referenced by TYPO3\CMS\Extbase\Error\Result\getFlattenedNotices().

◆ flattenWarningsTree()

TYPO3\CMS\Extbase\Error\Result::flattenWarningsTree ( array &  $result,
array  $level 
)
protected
Parameters
array$result
array$level

Definition at line 412 of file Result.php.

References TYPO3\CMS\Extbase\Error\Result\$warnings.

Referenced by TYPO3\CMS\Extbase\Error\Result\getFlattenedWarnings().

◆ forProperty()

Result TYPO3\CMS\Extbase\Error\Result::forProperty ( ?string  $propertyPath)

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"

Parameters
string | null$propertyPath
Returns
Result

Definition at line 189 of file Result.php.

References TYPO3\CMS\Extbase\Error\Result\recurseThroughResult().

Referenced by TYPO3\CMS\Extbase\Error\Result\merge().

◆ getErrors()

Error [] TYPO3\CMS\Extbase\Error\Result::getErrors ( )

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

Returns
Error[]

Definition at line 122 of file Result.php.

References TYPO3\CMS\Extbase\Error\Result\$errors.

◆ getFirstError()

bool Error TYPO3\CMS\Extbase\Error\Result::getFirstError ( )

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

Returns
‪bool|Error

Definition at line 152 of file Result.php.

◆ getFirstNotice()

bool Notice TYPO3\CMS\Extbase\Error\Result::getFirstNotice ( )

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

Returns
‪bool|Notice

Definition at line 174 of file Result.php.

◆ getFirstWarning()

bool Warning TYPO3\CMS\Extbase\Error\Result::getFirstWarning ( )

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

Returns
‪bool|Warning

Definition at line 163 of file Result.php.

◆ getFlattenedErrors()

array<string,array<Error> > TYPO3\CMS\Extbase\Error\Result::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)

Returns
‪array<string,array<Error>>

Definition at line 357 of file Result.php.

References TYPO3\CMS\Extbase\Error\Result\flattenErrorTree().

◆ getFlattenedNotices()

array<string,array<Notice> > TYPO3\CMS\Extbase\Error\Result::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)

Returns
‪array<string,array<Notice>>

Definition at line 385 of file Result.php.

References TYPO3\CMS\Extbase\Error\Result\flattenNoticesTree().

◆ getFlattenedWarnings()

array<string,array<Warning> > TYPO3\CMS\Extbase\Error\Result::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)

Returns
‪array<string,array<Warning>>

Definition at line 371 of file Result.php.

References TYPO3\CMS\Extbase\Error\Result\flattenWarningsTree().

◆ getNotices()

Notice [] TYPO3\CMS\Extbase\Error\Result::getNotices ( )

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

Returns
Notice[]

Definition at line 142 of file Result.php.

References TYPO3\CMS\Extbase\Error\Result\$notices.

◆ getSubResults()

Result [] TYPO3\CMS\Extbase\Error\Result::getSubResults ( )

Get a list of all sub Result objects available.

Returns
Result[]

Definition at line 494 of file Result.php.

References TYPO3\CMS\Extbase\Error\Result\$propertyResults.

Referenced by TYPO3\CMS\Extbase\Error\Result\merge().

◆ getWarnings()

Warning [] TYPO3\CMS\Extbase\Error\Result::getWarnings ( )

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

Returns
Warning[]

Definition at line 132 of file Result.php.

References TYPO3\CMS\Extbase\Error\Result\$warnings.

◆ hasErrors()

bool TYPO3\CMS\Extbase\Error\Result::hasErrors ( )

Does the current Result object have Errors? (Recursively)

Returns
‪bool

Definition at line 295 of file Result.php.

Referenced by TYPO3\CMS\Extbase\Mvc\Controller\Argument\isValid(), and TYPO3\CMS\Extbase\Error\Result\setParent().

◆ hasMessages()

bool TYPO3\CMS\Extbase\Error\Result::hasMessages ( )

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

Returns
‪bool

Definition at line 269 of file Result.php.

References TYPO3\CMS\Extbase\Error\Result\$warningsExist.

Referenced by TYPO3\CMS\Extbase\Error\Result\merge().

◆ hasNotices()

bool TYPO3\CMS\Extbase\Error\Result::hasNotices ( )

Does the current Result object have Notices? (Recursively)

Returns
‪bool

Definition at line 335 of file Result.php.

Referenced by TYPO3\CMS\Extbase\Error\Result\setParent().

◆ hasWarnings()

bool TYPO3\CMS\Extbase\Error\Result::hasWarnings ( )

Does the current Result object have Warnings? (Recursively)

Returns
‪bool

Definition at line 315 of file Result.php.

Referenced by TYPO3\CMS\Extbase\Error\Result\setParent().

◆ merge()

◆ mergeProperty()

TYPO3\CMS\Extbase\Error\Result::mergeProperty ( Result  $otherResult,
string  $getterName,
string  $adderName 
)
protected

Merge a single property from the other result object.

Parameters
Result$otherResult
string$getterName
string$adderName

Definition at line 475 of file Result.php.

Referenced by TYPO3\CMS\Extbase\Error\Result\merge().

◆ recurseThroughResult()

Result TYPO3\CMS\Extbase\Error\Result::recurseThroughResult ( array  $pathSegments)
Todo:
‪: consider making this method protected as it will and should not be called from an outside scope
Parameters
array$pathSegments
Returns
Result

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

Definition at line 212 of file Result.php.

Referenced by TYPO3\CMS\Extbase\Error\Result\forProperty().

◆ setErrorsExist()

TYPO3\CMS\Extbase\Error\Result::setErrorsExist ( )
protected

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

Definition at line 232 of file Result.php.

Referenced by TYPO3\CMS\Extbase\Error\Result\addError(), and TYPO3\CMS\Extbase\Error\Result\setParent().

◆ setNoticesExist()

TYPO3\CMS\Extbase\Error\Result::setNoticesExist ( )
protected

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

Definition at line 256 of file Result.php.

Referenced by TYPO3\CMS\Extbase\Error\Result\addNotice(), and TYPO3\CMS\Extbase\Error\Result\setParent().

◆ setParent()

◆ setWarningsExist()

TYPO3\CMS\Extbase\Error\Result::setWarningsExist ( )
protected

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

Definition at line 244 of file Result.php.

Referenced by TYPO3\CMS\Extbase\Error\Result\addWarning(), and TYPO3\CMS\Extbase\Error\Result\setParent().

Member Data Documentation

◆ $errors

Error [] TYPO3\CMS\Extbase\Error\Result::$errors = array( )
protected

◆ $errorsExist

bool TYPO3\CMS\Extbase\Error\Result::$errorsExist = false
protected

Caches the existence of errors

Definition at line 32 of file Result.php.

◆ $notices

Notice [] TYPO3\CMS\Extbase\Error\Result::$notices = array( )
protected

◆ $noticesExist

bool TYPO3\CMS\Extbase\Error\Result::$noticesExist = false
protected

Caches the existence of notices

Definition at line 50 of file Result.php.

◆ $parent

Result TYPO3\CMS\Extbase\Error\Result::$parent
protected

Definition at line 60 of file Result.php.

Referenced by TYPO3\CMS\Extbase\Error\Result\setParent().

◆ $propertyResults

Result [] TYPO3\CMS\Extbase\Error\Result::$propertyResults = array( )
protected

The result objects for the sub properties

Definition at line 56 of file Result.php.

Referenced by TYPO3\CMS\Extbase\Error\Result\getSubResults().

◆ $warnings

Warning [] TYPO3\CMS\Extbase\Error\Result::$warnings = array( )
protected

◆ $warningsExist

bool TYPO3\CMS\Extbase\Error\Result::$warningsExist = false
protected

Caches the existence of warning

Definition at line 41 of file Result.php.

Referenced by TYPO3\CMS\Extbase\Error\Result\hasMessages().