Open 3l73 opened 2 months ago
A possible, not yet fully testet solution could be following code:
if (property_exists(get_class($object), $propertyName)) {
$reflectionService = GeneralUtility::makeInstance(ReflectionService::class);
$classSchema = $reflectionService->getClassSchema($object);
$property = $classSchema->getProperty($propertyName);
if ($property->getPrimaryType()->isCollection()) {
$types = array_map(
function (Type $type) {
return $type->getClassName();
},
$property->getPrimaryType()->getCollectionValueTypes()
);
return $property->getPrimaryType()->getClassName() . '<' . implode('|', $types) . '>';
}
return $property->getPrimaryType()->getBuiltinType();
}
The class AbstractMapping uses the TYPO3 ReflectionService to determine the correct data type.
This leads currently to the following exception:
Expected behavior
No exception occured.
To Reproduce
Used versions: TYPO3: v12.4.17 Extension version: 3e00a60366b14ba701e39256bcf21487052d6815 (@dev-master)
Additional context
This exception occured during a functional test.
The stacktrace is as followed:
The reflection service itself uses the frontend cache and an identifier as constructor arguments. Additionally it should be instantiated via
GeneralUtility::makeInstance()
.See: https://github.com/mia3/crossmedia_fourallportal/blob/3e00a60366b14ba701e39256bcf21487052d6815/Classes/Mapping/AbstractMapping.php#L511
The whole method seems to need refactoring, since the methods and there result of the reflection service changed.
Relates change log entries: