0

In our own extension we have a table that should have an n:m relation to itself.

I'll make a figurative example (our real case is similar to it): Let's call the table 'employee'.
Now an employee can be attached to other employees, e.g. I edit employee A and attach it to employee B. When I open employee B I would like to see that he has an attachement to employee A.

I tried the following configuration in the tca.php:

'linked_with' => array (
  'exclude' => 0,
  'label' => 'LLL:EXT:my_ext/locallang_db.xml:my_table.linked_with',
  'config' => array(
    'type' => 'group',
    'internal_type' => 'db',
    'allowed' => 'my_table',
    'size' => 6,
     'MM' => 'my_table_linked_mm',
     'MM_opposite_field' => 'my_table'
  )
)

However when I do this, then it saves only the relation in one direction, i.e. I see in employee A, that it has a relation to employee B. But when I open employee B I don't see any relation to employee A.

In the database one entry was saved with:

  • uid_local: ###UID of employee A###
  • uid_foreign: ###UID of employee B###
  • sorting: 0
  • sorting_foreign: 1

What am I doing wrong? I couldn't find a similar case on Google/Internet - all I found was with two different tables.

Stefan
  • 337
  • 6
  • 20

2 Answers2

0

Well, consider the case of two tables.

A - MM - B

in this case, you would have need a TCA field for table A linking to B via the MM table (with uid_local as the local uid) and a TCA field for table B linking to A via the MM table (with uid_foreign as the local uid)

You need the same in this case, that is a linked_from and links_to field or similar, with a mirror configuration.

adhominem
  • 1,104
  • 9
  • 24
0

Just a short feedback for other searchers:
Unfortunately, to date TYPO3 (vers. 4.7.4) doesn't support this feature.
To implement this feature, you have to write a userFunction.

Stefan
  • 337
  • 6
  • 20