Bug #78722
closedsys_category_record_mm does not have a uid field
0%
Description
sys_category_record_mm uses the field `fieldname` to allow multiple relations from the same table to sys_categories. However, the group field for items on the sys_category side does not have `multiple` and `MM_hasUidField` set to true. This leads to sideeffects when editing relations from a sys_category record using the `items` field.
Details:
This is caused by the RelationHandler disregarding all fields other than 'tablenames' and 'uid_foreign' should the table not have a uid. This behaviour can be seen here: https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_7-6-12/typo3/sysext/core/Classes/Database/RelationHandler.php#L645
At this point I can only confirm this behaviour for 7.6 since it seems like this method has been rewritten in 8.x
Example for a reproducable problem caused by this:
1. Add two category relations in ext_tables.php:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable($_EXTKEY, 'tx_myext_domain_model_mymodel', 'categories'); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable($_EXTKEY, 'tx_myext_domain_model_mymodel', 'other_categories');
2. Add 2 relations from your model to the same category by editing a record of your model
3. Open that category in the backend
4. Save the record without changing anything
Expected result: Relations should stay intact
Actual result: The relation to your model are both deleted