RelationResolver

readonly class \TYPO3\CMS\Core\DataHandling\RelationResolver

Finds relations for a RelationalFieldType field such as: - inline - select with foreign_table or MM - group with allowed or MM - category - file

Files are handled differently with specific File / FileReference objects instead of general Record objects. Therefore, resolveFileReferences() is used.

What it does to the outside world:

  • You have a record and a field with relations and you get a collection of the related raw DB records.

What it hides:

  • How the DB queries are made.

The result is usually wrapped in a Closure, so it is only called when needed, however this piece of code does not care about how it is used.

Table of Contents

Properties

$greedyDatabaseBackend  : GreedyDatabaseBackend
$resourceFactory  : ResourceFactory
$runtimeCache  : FrontendInterface

Methods

__construct()  : mixed
resolve()  : array<int, array{table: string, row: array}>
This method currently returns an array with "table" and "row" pairs, but will probably return something else in the future.
resolveFileReferences()  : FileReference[]
getGroupedRelationIds()  : array<int, array<string, mixed>>
We currently use the RelationHandler to resolve all records attached to a given field.
getRelationalRows()  : array<string, array<int, array{table: string, row: array}>>
Find the relations relevant for this field. This could be multiple tables!

Properties

Methods

getGroupedRelationIds()

We currently use the RelationHandler to resolve all records attached to a given field.

protected getGroupedRelationIds(RecordInterface $record, FieldTypeInterface $fieldInformation, Context $context) : array<int, array<string, mixed>>

Parameters

$record : RecordInterface
$fieldInformation : FieldTypeInterface
$context : Context

Tags

todo

This will be replaced by querying the RefIndex directly in the future.

Return values

array<int, array<string, mixed>>

getRelationalRows()

Find the relations relevant for this field. This could be multiple tables!

protected getRelationalRows(array $necessaryRelationsOfRequestedField, Context $context) : array<string, array<int, array{table: string, row: array}>>

Note: While $necessaryRelationsOfRequestedField is sorted, the result will be the plain unsorted database rows.

Parameters

$necessaryRelationsOfRequestedField : array
$context : Context

Return values

array<string, array<int, array{table: string, row: array}>>
On this page