Dynamic TCA loading 

Retrieval of the TCA global array is encapsulated in a class called \Cobweb\ExternalImport\Domain\Repository\TcaDirectAccessRepository which implements the \Cobweb\ExternalImport\Domain\Repository\TcaRepositoryInterface interface. This system pursues three aims:

  1. encapsulating the retrieval of the TCA to simplify following up the evolutions in the TYPO3 Core (like the introduction of the TCA Schema in TYPO3 13).
  2. abstracting into a base class ( \Cobweb\ExternalImport\Domain\Repository\AbstractTcaRepository) all the logic for retrieving all External Import-related configuration from the TCA.
  3. allowing developers to perfom dynamic manipulations on the TCA by providing their own TCA repository class through dependency injection. This is detailed below.

Custom TCA repository 

Although an event exists for manipulating a single import configuration, it is not unusual to have repetitive import configurations, sometimes implying a dynamic modification of the TCA. For such special cases, it may be useful to provide your own custom implementation of a TCA repository.

The recommended way is to extend the abstract class \Cobweb\ExternalImport\Domain\Repository\AbstractTcaRepository which implements all the methods related to extracting the External Import configurations from the TCA. The only method to implement is getTca(), where you can perform any processing you need. Then simply declare your repository as a service replacing \Cobweb\ExternalImport\Domain\Repository\TcaDirectAccessRepository, by placing in your extension's Services.yaml file the following:

services:
  _defaults:
    autowire: true
    autoconfigure: true
    public: false

  Vendor\ExtName\Import\DynamicTcaRepository:
    decorates: Cobweb\ExternalImport\Domain\Repository\TcaRepositoryInterface
    public: true
Copied!