Project

General

Profile

Actions

Bug #105317

closed

TypeError: TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::thawObjectProperty(): Return value must be of type ?object, array returned

Added by Daniel Siepmann about 1 month ago. Updated 21 days ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2024-10-16
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
13
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Steps to reproduce:

  1. Create an Extbase Model with a property of Type TYPO3\CMS\Core\Resource\Folder.
  2. Configure the property/column in TCA, see below example.
  3. Save record with empty value
  4. 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:
  1. Always set explicitly configured relationship value first as default.
  2. Set HAS_ONE properly in first condition of special folder handling.
  3. Let FolderFieldType implement RelationalFieldTypeInterface
Actions

Also available in: Atom PDF