Project

General

Profile

Actions

Bug #51921

closed

Only 1 category field per table possible

Added by Sebastian Michaelsen over 10 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2013-09-11
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.1
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Since the CategoryRegistry was refactored between 6.0 and 6.1 it's not possible anymore to have more than one category field per table.

CategoryRegistry->add() does:

        $this->registry[$extensionKey][$tableName] = array (
            'fieldName' => $fieldName,
            'options' => $options,
        );

So every call overwrites the data of previous calls.

Example:

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable('myext', 'tx_myext_domain_model_event', 'categories1', array(
    'fieldConfiguration' => array(
        'foreign_table_where' => ' AND sys_category.pid = ' . 1 . ' ORDER BY sys_category.title ASC',
        'MM_match_fields' => array(
            'tablenames' => 'tx_myext_domain_model_event',
            'field_name' => 'categories1'
        ),
    ),
));
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable('myext', 'tx_myext_domain_model_event', 'categories2', array(
    'fieldConfiguration' => array(
        'foreign_table_where' => ' AND sys_category.pid = ' . 2 . ' ORDER BY sys_category.title ASC',
        'MM_match_fields' => array(
            'tablenames' => 'tx_myext_domain_model_event',
            'field_name' => 'categories2'
        ),
    ),
));

There should be 2 category fields showing categories from two different storage folders, but only 'categories2' will work.

Code example: https://gist.github.com/smichaelsen/6534198


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #52285: CategoryCollection must handle multiple category fields per tableClosedFrancois Suter2013-09-26

Actions
Actions

Also available in: Atom PDF