---
title: "MM"
manual: "TCA Reference"
version: "14.3"
permalink: "https://docs.typo3.org/permalink/t3tca:tca-property-mm@14.3"
source: "ColumnsConfig/CommonProperties/Mm.rst"
rendered: "2026-10-01T16:42:39+00:00"
---

# MM {#tca-property-mm}

-   **MM**

    -   *Type:* string (table name)
    -   *TCA path:* $GLOBALS\['TCA'\]\[$table\]\['columns'\]\[$field\]\['config'\]\['MM'\]
    -   *Scope:* Proc.
    -   *Types:* [group](https://docs.typo3.org/permalink/t3tca:columns-group@14.3), [select](https://docs.typo3.org/permalink/t3tca:columns-select@14.3), [inline](https://docs.typo3.org/permalink/t3tca:columns-inline@14.3)

    The relation of the records of the specified table gets stored in an
    intermediate table. The name of this table is stored in the property `MM`.

    This property is used with [foreign_table (select)](https://docs.typo3.org/permalink/t3tca:columns-select-properties-foreign-table@14.3)
    for `select` fields, [allowed (group)](https://docs.typo3.org/permalink/t3tca:columns-group-properties-allowed@14.3) for
    `group` fields or [foreign_table (inline)](https://docs.typo3.org/permalink/t3tca:columns-inline-properties-foreign-table@14.3) for `inline` fields.

    The table defined in this property is [automatically created by the
    Database Analyzer](https://docs.typo3.org/permalink/t3tca:tca-property-mm-auto-creation-mm-table@14.3).

    The field for which an MM configuration exists stores the number of records
    in the relation on each update, so the field should be an integer.

> [!NOTE]
> Using MM relations you can **only** store the relations for foreign tables
> in the list. You cannot add properties like string values for the relation
> itself.

## MM relations and FlexForms {#columns-config-common-properties-mm}

MM relations has been tested to work with FlexForms if not in a repeated
element in a section.

## Related configurations {#columns-config-common-properties-mm-related-configurations}

### MM_match_fields {#columns-config-common-properties-mm-related-configurations-mm-match-fields}

-   **MM_match_fields**

    -   *Type:* array
    -   *Scope:* Display / Proc.

    Array of field=>value pairs to both insert and match against when writing/reading MM relations.

### MM_opposite_field {#columns-config-common-properties-mm-related-configurations-mm-opposite-field}

-   **MM_opposite_field**

    -   *Type:* string (field name)
    -   *Scope:* Proc.

    If you want to make a MM relation editable from the foreign side (bidirectional) of the relation as well, you need
    to set `MM_opposite_field` on the foreign side to the field name on the local side.

    E.g. if the field "companies.employees" is your local side and you want to make the same relation editable from
    the foreign side of the relation in a field called persons.employers, you would need to set the `MM_opposite_field`
    value of the TCA configuration of the persons.employers field to the string "employees".

    > [!NOTE]
    > Bidirectional references only get registered once on the native side in "sys_refindex".

### MM_oppositeUsage {#columns-config-common-properties-mm-related-configurations-mm-opposite-usage}

-   **MM_oppositeUsage**

    -   *Type:* array
    -   *Scope:* Proc.

    In a MM bidirectional relation using [select match fields](https://docs.typo3.org/permalink/t3tca:columns-select-properties-mm-match-fields@14.3)
    / [group match fields](https://docs.typo3.org/permalink/t3tca:columns-group-properties-mm-match-fields@14.3) the opposite side needs to know about
    the match fields for certain operations (for example, when a copy is created in a workspace) so that relations
    are carried over with the correct information.

    `MM_oppositeUsage` is an array which references which fields contain the
    references to the opposite side, so that they can be queried for match
    field configuration.

### MM_table_where {#columns-config-common-properties-mm-related-configurations-mm-table-where}

-   **MM_table_where**

    -   *Type:* string (SQL WHERE)
    -   *Scope:* Proc.

    Additional where clause used when reading MM relations.

    Example:

    ```text
    {#uid_local} = ###THIS_UID###
    ```

    The above example uses the special field quoting syntax `{#...}` around
    identifiers to be as [DBAL](https://docs.typo3.org/m/typo3/reference-coreapi/14.3/en-us/ApiOverview/Database/Index.html#database)-compatible as possible.

## Auto creation of intermediate MM tables from TCA {#tca-property-mm-auto-creation-mm-table}

> [!NOTE]
> The intermediate mm tables defined in `['config']['MM']`
> are created automatically.

TCA table column fields that define `['config']['MM']` can
drop specification of the intermediate mm table layout in:
`ext_tables.sql`. The TYPO3 database analyzer
takes care of proper schema definition.

Extensions are strongly encouraged to drop `ext_tables.sql`
`CREATE TABLE` definitions for those intermediate tables referenced by
`TCA` table columns. Dropping these definitions allows the Core to adapt
and migrate definitions if needed.

The mm tables are automatically created if:

-   A table column TCA config defines `MM` with `type='select'`,
    `type='group'` or `type='inline'`.
-   The "MM" intermediate table has *no* TCA table definition (!).
-   A table of the resulting name is not defined in `ext_tables.sql`.

The schema analyzer takes care of further possible fields apart from
`uid_local` and `uid_foreign`, like `tablenames`,
`fieldname` and `uid` if necessary, depending on local side of the
TCA definition.

The fields used for sorting `sorting` and `sorting_foreign` are
always created, they do not need to be defined in TCA.

### Example {#tca-property-mm-auto-creation-mm-table-example}

The "local" side of a mm table is defined as such in TCA:

**EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php**

```php
<?php

return [
  'ctrl' => [
    'title' => 'Something',
    'label' => 'title',
  ],
  'columns' => [
    'title' => [
      'label' => 'Title',
      'config' => [
        'type' => 'input',
      ],
    ],
    'my_field' => [
      'label' => 'My field',
      'config' => [
        'type' => 'group',
        'allowed' => 'tx_myextension_myfield_child',
        'MM' => 'tx_myextension_myfield_mm',
      ],
    ],
  ],
  'types' => [
    '0' => [
      'showitem' => 'title, my_field',
    ],
  ],
];

```

A table like the following will be automatically created in the Database
Analyzer:

**Table created automatically by the Database Analyzer**

```sql
CREATE TABLE tx_myextension_myfield_mm (
    uid_local int(11) DEFAULT '0' NOT NULL,
    uid_foreign int(11) DEFAULT '0' NOT NULL,
    sorting int(11) DEFAULT '0' NOT NULL,
    sorting_foreign int(11) DEFAULT '0' NOT NULL,

    KEY uid_local (uid_local),
    KEY uid_foreign (uid_foreign)
);
```

### Columns of the intermediate MM table {#tca-property-mm-auto-creation-mm-table-columns-intermediate-mm}

The intermediate table may have the following fields:

-   **uid_local, uid_foreign**

    Storing uids of both sides. If done right, this is reflected in the table
    name - `tx_foo_local_foreign_mm`

-   **sorting, sorting_foreign**

    Are required fields used for ordering the items.

-   **tablenames**

    Is used if multiple tables are allowed in the relation.

-   **uid (auto-incremented and PRIMARY KEY)**

    May be used if you need the "multiple" feature (which allows the same record to be references multiple times
    in the box.

-   **further fields**

    May exist, in particular if [MM_match_fields](https://docs.typo3.org/permalink/t3tca:columns-select-properties-mm-match-fields@14.3) /
    [MM_match_fields](https://docs.typo3.org/permalink/t3tca:columns-group-properties-mm-match-fields@14.3) is involved in the set up.
