Bug #90214

TCA maxitems is ignored

Added by Florian Rival over 1 year ago. Updated about 1 year ago.

Needs Feedback
Should have
Target version:
Start date:
Due date:
% Done:


Estimated time:
TYPO3 Version:
PHP Version:
Is Regression:
Sprint Focus:



When setting TCA maxitems to 1 for INLINE relations, and update the record from FE form, maxitems is ignored, many relations are created in sys_file_reference where there should be only one.

New relation is inserted but old relation is not deleted.

Sample TCA :

    'cv' => [
        'exclude' => false,
        'label' => 'cv',
        'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
                'minitems' => 0,
                'maxitems' => 1,
                'foreign_match_fields' => [
                    'fieldname' => 'cv',
                    'tablenames' => 'fe_users',
                    'table_local' => 'sys_file',

And update with :


The bug appeared in Typo3 9.5.13 but wasn't present in previous V9 versions (don't know exactly which one).



Bug maxitems.jpg (51.3 KB) Bug maxitems.jpg Florian Rival, 2020-01-27 12:59

Updated by Florian Rival over 1 year ago

  • Category set to Extbase

Updated by Alexander Schnitzler about 1 year ago

  • Assignee set to Alexander Schnitzler

Updated by Alexander Schnitzler about 1 year ago

  • Status changed from New to Needs Feedback

I am not sure about this ticket. Can you explain what exactly worked and stopped working suddenly?
With a more detailed description I could search for code that changed.

Besides that: maxitems is not evaluted by Extbase to validate the amount of records being stored.
maxitems is used to determine the exact type of relation between tables, but nothing more.


Updated by Florian Rival about 1 year ago

Hi Alexander,

The use case is :

  • I have a record with a file attached (a user with a CV for example, look sample TCA in bug description)
  • In FE, I want to edit informations for this record with actions : editAction() and updateAction()
function editAction() {
    $uid = GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('frontend.user', 'id', 0);
    $user = $this->userRepository->findByIdentifier($uid);
    $this->view->assign('user', $user);

Then in Edit.html the form look like this :

<f:form action="update" name="user" object="{user}" >
    <f:form.upload property="cv" additionalAttributes="{accept :'application/pdf'}" />

And in update action :

public function initializeUpdateAction(): void
    $fileUploadConfiguration = [
        UploadedFileReferenceConverter::CONFIGURATION_FILE_VALIDATORS => ['application/pdf'],
        UploadedFileReferenceConverter::CONFIGURATION_UPLOAD_FOLDER => $this->settings['folders']['cvFolder'],

    /** @var PropertyMappingConfiguration $newUserConfiguration */
    $newUserConfiguration = $this->arguments['user']->getPropertyMappingConfiguration();

    $newUserConfiguration->forProperty('cv')->setTypeConverterOptions(UploadedFileReferenceConverter::class, $fileUploadConfiguration);

public function updateAction(User $user): void
  • so, in FE form, I upload a new file (CV) and this new file should replace the old one
  • but the result is not as expected :
    - new file is attached to record : so far so good
    - old file is not removed for this record
  • the you have two files attached to that record instead of one - have a look at picture in description

Hope it help,


Updated by Alexander Schnitzler about 1 year ago

Hi Florian,

with that code attached I understand your use case much better.

I am still not quite sure where we would find the error exactly. I would need to debug the data mapper and the property mapper to see what exactly happens here and why the current object storage does not completely override the old one. That does not even have anything to do with maxitems here. It seems that property relations are merged. I currently don't know what the desired behaviour would be (for all), what actually makes sense and why things are like they are.

Also available in: Atom PDF