Bug #62755
closedTCA - showing wrong uids for FAL fields in BE list module
100%
Description
There is a model which contains more than one FAL property. Each FAL property is defined using "getFileFieldTCAConfig" as folows:
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'images1',
array(
'maxitems' => 5,
'foreign_match_fields' => array(
'fieldname' => 'images1',
'tablenames' => 'tx_myext_domain_model_xyz',
'table_local' => 'sys_file',
),
),
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
For example, these two fields are called "images1" and "images2". Now there are one (or more) files beeing assigned to the first field "images1" in BE. After this, if you view the db table using the list module (expand the table by clicking on the "+" icon, then select "images1" and "images2" to be shown), both columns show the same UIDs. Independant from which field has how many files assigned, the displayed UIDs for "images1" and "images2" are always the same.
I looks like all references from sys_file or sys_file_reference related to this table are shown, not filtered by the concrete local field.
Updated by Frans Saris almost 10 years ago
- Target version changed from next-patchlevel to 7.1 (Cleanup)
- Sprint Focus set to On Location Sprint
Updated by Dirk Wenzel almost 10 years ago
I experienced a similar issue which might be related:
There is a model with a field for multiple files:
class Proposal extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity { /** * Files * * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> */ protected $files; ... }
The TCA for this field is:
'files' => array( 'exclude' => 0, 'label' => 'LLL:EXT:cps_proposals/Resources/Private/Language/locallang_db.xlf:tx_cpsproposals_domain_model_proposal.files', 'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('files', array( 'appearance' => array( 'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference' ), // custom configuration for displaying fields in the overlay/reference table // to use the imageoverlayPalette instead of the basicoverlayPalette 'foreign_match_fields' => array( 'fieldname' => 'files', 'tablenames' => 'tx_cpsproposals_domain_model_proposal', 'table_local' => 'sys_file', ), 'foreign_types' => array( '0' => array( 'showitem' => ' --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' ), \TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => array( 'showitem' => ' --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' ), \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => array( 'showitem' => ' --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' ), \TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => array( 'showitem' => ' --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' ), \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => array( 'showitem' => ' --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' ), \TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => array( 'showitem' => ' --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' ) ) ), $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']), ),
For some instances of this model the list view shows one or more reference uids even though the DB value of this field is 0.
There are records in table sys_file_reference where the field 'foreign_uid' contains the same value as one of this instances but the fields 'tablenames' and 'fieldname' do contain other values, for instance:
uid deleted uid_foreign uid_local tablenames fieldnames ... 41 0 27 13 tt_content image 87 1 411 13 tx_cpspropsals_domain_model_proposal files
The list view shows '41' in field 'files' for the tx_cpsproposals_domain_model_proposal record.
In edit view no reference is shown.
Obviously the contraints defined by the 'matchfields' value in TCA
'foreign_match_fields' => array( 'fieldname' => 'files', 'tablenames' => 'tx_cpsproposals_domain_model_proposal', 'table_local' => 'sys_file', ),
are ignored.
The records are created through the frontend. My implementation uses the upload mechanism from Helmut Hummel (see [1] und [2]).
I debugged the upload process thoroughly and could not detect any flaw.
An update of the reference index did not improve the situation. If the sys_file_reference entry of the other record (tt_content, uid 41 in my example above) is set to deleted=1 the wrong uid disappears from list view.
[1] http://insight.helhum.io/post/85015526410/file-upload-using-extbase-and-fal-in-typo3-6-2
[2] https://github.com/helhum/upload_example/blob/master/Classes/Property/TypeConverter/UploadedFileReferenceConverter.php
Cheers Dirk
Updated by Gerrit Code Review almost 10 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36382
Updated by Gerrit Code Review almost 10 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36382
Updated by Gerrit Code Review almost 10 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36382
Updated by Alina Fleser almost 10 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset c47c35744adb8b3243cbff5c91dc40672bec93f2.
Updated by Gerrit Code Review almost 10 years ago
- Status changed from Resolved to Under Review
Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36445
Updated by Alina Fleser almost 10 years ago
- Status changed from Under Review to Resolved
Applied in changeset e384a7adf00fa2f6391b40dbd11e1009890053a8.
Updated by Anja Leichsenring almost 9 years ago
- Sprint Focus deleted (
On Location Sprint)
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed