Project

General

Profile

Actions

Feature #81631

open

foreign_match_fields should allow a not-equal option

Added by Johannes Schlier almost 7 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2017-06-20
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Foreign_match_fields are really useful to differentiate cases when using the same foreign table.
One case that I think should also be considered is the following:

Suppose you have a table 'tx_something' and you have a type field that might go up to 100 or so.
Now you want to do something special with type 1 (overriding some values in the TCA for example). All the other types should still be available, but in another field that doesn't have the overridden TCA.

Without a foreign_match_field the records with type 1 would show up in the general field as well.
The way foreign_match_fields currently works would require a new field for every non-special type, which is really unnecessary and not great should new types be added at a later point.

So I would suggest something like the following:

'specialField' => [
  'config' => [
    'type' => 'inline',
    'foreign_table' => 'tx_something',
    'foreign_match_fields' => [
        'type' => 1
    ],
    'overrideChildTca' => [
        'val1' => 'foo',
        'val2' => 'bar',
        'val3' => 'foobar'
    ]
  ]
],
'generalField' => [
  'config' => [
    'type' => 'inline',
    'foreign_table' => 'tx_something',
    'foreign_match_fields' => [

      'type' => '!1'

    ]
]

This could then be parsed by the RelationHandler, which would replace the 'eq' in the where expression it's constructing with a 'neq' and deliver the wanted results.

No data to display

Actions

Also available in: Atom PDF