#105317TypeError: TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::thawObjectProperty(): Return value must be of type ?object, array returned
Description
Steps to reproduce:
- Create an Extbase Model with a property of Type
TYPO3\CMS\Core\Resource\Folder. - Configure the property/column in TCA, see below example.
- Save record with empty value
- Map database record to model
Expected behaviour: null is assigned to property.
Actual behaviour: The TypeError is thrown.
Results of first debugging:
The extbase/Classes/Persistence/Generic/Mapper/ColumnMapFactory.php fails to properly set the type of relation in that scenario. I’d expect it to be Relation::HAS_ONE, but it is not set at all within: setRelations()
Example TCA:
'files_folder' => [
'exclude' => true,
'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.files_folder',
'description' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.files_folder.description',
'config' => [
'type' => 'folder',
'size' => 1,
'maxitems' => 1,
// No effect, code returns without taking this into account.
// 'relationship' => 'oneToOne',
],
],
Ideas:
- Always set explicitly configured
relationshipvalue first as default. - Set HAS_ONE properly in first condition of special folder handling.
- Let
FolderFieldTypeimplementRelationalFieldTypeInterface