Bug #90214


TCA maxitems is ignored

Added by Florian Rival over 4 years ago. Updated about 1 month ago.

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
Actions #1

Updated by Florian Rival over 4 years ago

  • Category set to Extbase
Actions #2

Updated by Alexander Schnitzler over 4 years ago

  • Assignee set to Alexander Schnitzler
Actions #3

Updated by Alexander Schnitzler over 4 years 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.

Actions #4

Updated by Florian Rival over 4 years 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,

Actions #5

Updated by Alexander Schnitzler over 4 years 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.

Actions #6

Updated by Christian Kuhn over 2 years ago

  • Status changed from Needs Feedback to New
Actions #7

Updated by Thomas Löffler over 1 year ago

It seems that the upload_example of Helmut ( is used here.
As the example is only coded to add files and not to replace files there is a need of adapting the example's code.

Imho it's not a bug in the Core. It's a missing feature in the example.

Actions #8

Updated by Georg Ringer about 1 month ago

  • Status changed from New to Rejected

extbase doesn't care about this restriction, same like minitems. and you need to take care about that yourself. therefore I am closing this issue

regarding the upload_example: with 13 it is planned to have a solution within the core, see Feature #103511: Introduce Extbase file upload handling

Actions #9

Updated by Georg Ringer about 1 month ago

  • Status changed from Rejected to Closed

Also available in: Atom PDF