When your table has more than 1 field with relations to sys_category you will run into problems because the MM relation table sys_category_record_mm will only store which table a category belongs to - but not the specific field.
You need to extend sys_category_record_mm like this:
Add the following to your extension's ext_tables.sql:
CREATE TABLE sys_category_record_mm (
field_name varchar(255) DEFAULT '' NOT NULL
);
Use the extension manager to bring your SQL changes into effect.
Then adjust your makeCategorizable() calls to look like this:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable(
'my_ext', // Your Extension key
'tx_myext_domain_model_mytable', // the table
'categories', // the field name
array( // override the default configuration
'fieldConfiguration' => array(
'MM_match_fields' => array(
'field_name' => 'categories' // the field name again
)
)
)
);
--
Sebastian Michaelsen [email protected]
TYPO3 Freelancer