TCA Override

Basic

Each Content Element type has to be registered for dataflow via TCA Overrides .
This is done with the function addDataflowFieldsToContentElement from

class Jar\Dataflow\Utilities\DataflowUtility

Jar\Dataflow\Utilities\DataflowUtility::addDataflowFieldsToContentElement($cType, $foreignTable, $configuration)
Parameters
  • $cType (string) -- CType of the content element.

  • $foreignTable (string) -- Table name of the foreign table.

  • $enablePagination (bool) -- Activates pagination options in Backend and outputs paginated elements.

  • $configuration (array) -- Advanced configuration.

  • $configuration['foreignSortableColumns'] (array) -- Whitelist of columns which are selectable for sorting.

  • $configuration['foreignConstraints'] (array) -- For developers

\Jar\Dataflow\Utilities\DataflowUtility::addDataflowFieldsToContentElement('html', 'tx_j77template_utility_jobs', [
    'enablePagination' => true,
    // you could write contraints directly as string, be careful when using dynamic values! No Escaping will be used here!
    'foreignConstraints' => [
         '`tx_j77template_utility_jobs`.`jobtype` = 12345'
    ]
]);

For developers

array $foreignConstraints
Param bool $userFunc

userFunc

Param bool $parameters

Parameters for the userFunc.

\Jar\Dataflow\Utilities\DataflowUtility::addDataflowFieldsToContentElement('html', 'tx_j77template_utility_jobs', [
    'foreignConstraints' => [
        [
            'userFunc' => \EXT\CustomNamespace\Constraints\CustomConstraints::class . '->getListConstraints',
            'parameters' => [
                'hello' => 'world'
            ]
        ]
    ]
]);

The userFunc can be used to add custom contraints for the crawled items.
E.g. all items with the uid greater 1330 and less than 1432.

/**
* @param ExpressionBuilder $expressionBuilder
* @param array $params
* @return array
*/
public function getListConstraints(ExpressionBuilder $expressionBuilder, array $params = []): array {
    $table = $params['table'];
    $result = [
        $expressionBuilder->gte($table . '.uid', 1331),
        $expressionBuilder->lte($table . '.uid', 1431)
    ];
    return $result;
}