Bug #105317
Updated by Daniel Siepmann 5 months ago
Steps to reproduce:
# Create an Extbase Model with a property of Type <code>TYPO3\CMS\Core\Resource\Folder</code>.
# Configure the property/column in TCA, see below example.
# Save record with empty value
# Map database record to model
Expected behaviour: <code>null</code> is assigned to property.
Actual behaviour: The <code>TypeError</code> is thrown.
Results of first debugging:
The <code>extbase/Classes/Persistence/Generic/Mapper/ColumnMapFactory.php</code> fails to properly set the type of relation in that scenario. I'd expect it to be <code>Relation::HAS_ONE</code>, but it is not set at all within: <code>setRelations()</code>
Example TCA:
<pre><code class="php">
'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',
],
],
</code></pre>
Ideas:
# Always set explicitly configured <code>relationship</code> value first as default.
# Set HAS_ONE properly in first condition of special folder handling.
# Let <code>FolderFieldType</code> implement <code>RelationalFieldTypeInterface</code>