Bug #51921

Only 1 category field per table possible

Added by Sebastian Michaelsen about 6 years ago. Updated about 1 year ago.

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

100%

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

Related to TYPO3 Core - Bug #52285: CategoryCollection must handle multiple category fields per table Closed 2013-09-26

Associated revisions

Revision 1461ad2f (diff)
Added by Sebastian Michaelsen about 6 years ago

[FEATURE] Allow multiple category fields per table

It is only possible to do one makeCategorizable() call per
table, because if you do more the later calls would overwrite the
previous category field declaration. That's because of the way
the registry stores the category fields - it can only store one
field per table. This change improves that and allow multiple
fields pers table.

Additionally, a custom label can be set in the options array
for each category field.

Resolves: #51921
Releases: 6.2
Change-Id: I96d1235176109395339e9841564edadc0c71147d
Reviewed-on: https://review.typo3.org/23772
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
Reviewed-by: Markus Klein
Tested-by: Markus Klein

History

#1 Updated by Gerrit Code Review about 6 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23772

#2 Updated by Gerrit Code Review about 6 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23772

#3 Updated by Gerrit Code Review about 6 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23772

#4 Updated by Gerrit Code Review about 6 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23772

#5 Updated by Gerrit Code Review about 6 years ago

Patch set 5 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23772

#6 Updated by Gerrit Code Review about 6 years ago

Patch set 6 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23772

#7 Updated by Gerrit Code Review about 6 years ago

Patch set 7 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23772

#8 Updated by Gerrit Code Review about 6 years ago

Patch set 8 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23772

#9 Updated by Gerrit Code Review about 6 years ago

Patch set 9 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23772

#10 Updated by Gerrit Code Review about 6 years ago

Patch set 10 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23772

#11 Updated by Gerrit Code Review about 6 years ago

Patch set 11 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23772

#12 Updated by Gerrit Code Review about 6 years ago

Patch set 12 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23772

#13 Updated by Gerrit Code Review about 6 years ago

Patch set 13 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23772

#14 Updated by Gerrit Code Review about 6 years ago

Patch set 14 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23772

#15 Updated by Gerrit Code Review about 6 years ago

Patch set 15 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23772

#16 Updated by Gerrit Code Review about 6 years ago

Patch set 16 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23772

#17 Updated by Gerrit Code Review about 6 years ago

Patch set 17 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23772

#18 Updated by Gerrit Code Review about 6 years ago

Patch set 18 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23772

#19 Updated by Gerrit Code Review about 6 years ago

Patch set 19 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23772

#20 Updated by Anonymous about 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#21 Updated by Benni Mack about 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF