Project

General

Profile

Actions

Task #102263

closed

Return string version of Stringable objects in DataMapper::getPlainValue

Added by Soren Malling 7 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2023-10-26
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

The DataMapper::getPlainValue expects a object to be a instance of TypeInterface in order to return a plain value.

The TypoInterface holds the `__toString` method - making it `a instance of Stringable`.

Objects/value objects coming from own extensions, not implementing the TypeInterface but being a `Stringable` (either by `implements \Stringable` or having the `__toString` method) throws the exception

`throw new UnexpectedTypeException('An object of class "' . get_class($input) . '" could not be converted to a plain value.', 1274799934);`

Suggestion here, being that the condition also allows a object being a stringable

From:
`if (TypeHandlingUtility::isCoreType($input)) {`

To:
`if (TypeHandlingUtility::isCoreType($input) || ($input instanceof \Stringable)) {`

Actions

Also available in: Atom PDF