schemata = new SchemaCollection([]); } /** * Get a schema from the loaded TCA. Ensure to check for a schema with ->has() before * calling ->get(). * @throws UndefinedSchemaException */ public function get(string $schemaName): TcaSchema { return $this->schemata->get($schemaName); } /** * Checks if a schema exists, does not build the schema if not needed, thus it's very slim * and only creates a schema if a sub-schema is requested. */ public function has(string $schemaName): bool { return $this->schemata->has($schemaName); } /** * Returns all main schemata * * @return SchemaCollection */ public function all(): SchemaCollection { return $this->schemata; } /** * Only used for functional tests, which override TCA on the fly for specific test cases. * Modifying TCA other than in Configuration/TCA/Overrides must be avoided in production code. * * @internal only used for TYPO3 Core internally, never use it in public! */ public function rebuild(array $fullTca): void { $this->schemata = $this->schemaBuilder->buildFromStructure($fullTca); } /** * Load TCA and populate all schema - throws away existing schema if $force is set. * * @internal only used for TYPO3 Core internally, never use it in public! */ public function load(array $tca, bool $force = false): void { if (!$force && $this->schemata->count() > 0) { return; } if (!$force && $this->cache->has($this->cacheIdentifier)) { $this->schemata = $this->cache->require($this->cacheIdentifier); return; } $this->rebuild($tca); $this->cache->set($this->cacheIdentifier, 'return ' . var_export($this->schemata, true) . ';'); } #[AsEventListener('typo3-core/tca-schema')] public function warmupCaches(CacheWarmupEvent $event): void { if ($event->hasGroup('system')) { $this->schemata = new SchemaCollection([]); $this->load($GLOBALS['TCA'], true); } } }