Classes/TcaDataGenerator/RecordData.php
public function generate(string $tableName, array $fieldValues): array
    {
        $tca = $GLOBALS['TCA'][$tableName];
        /** @var FieldGeneratorResolver $resolver */
        $resolver = GeneralUtility::makeInstance(FieldGeneratorResolver::class);
        foreach ($tca['columns'] as $fieldName => $fieldConfig) {
            // Generate only if there is no value set, yet
            if (isset($fieldValues[$fieldName])) {
                continue;
            }
            $data = [
                'tableName' => $tableName,
                'fieldName' => $fieldName,
                'fieldConfig' => $fieldConfig,
                'fieldValues' => $fieldValues,
            ];
            try {
                $generator = $resolver->resolve($data);
                $fieldValues[$fieldName] = $generator->generate($data);
            } catch (GeneratorNotFoundException $e) {
                // No op if no matching generator was found
            }
        }
        return $fieldValues;
    }
public function generate(string $tableName, array $fieldValues): array
    {
        $tca = $GLOBALS['TCA'][$tableName];
        /** @var FieldGeneratorResolver $resolver */
        $resolver = GeneralUtility::makeInstance(FieldGeneratorResolver::class);
        foreach ($tca['columns'] as $fieldName => $fieldConfig) {
            // Generate only if there is no value set, yet
            if (isset($fieldValues[$fieldName])) {
                continue;
            }
            $data = [
                'tableName' => $tableName,
                'fieldName' => $fieldName,
                'fieldConfig' => $fieldConfig,
                'fieldValues' => $fieldValues,
            ];
            try {
                $generator = $resolver->resolve($data);
                $fieldValues[$fieldName] = $generator->generate($data);
            } catch (GeneratorNotFoundException $e) {
                // No op if no matching generator was found
            }
        }
        return $fieldValues;
    }
public function generate ( string $ tableName , array $ fieldValues ) : array { $ tca = $ GLOBALS [ 'TCA' ] [ $ tableName ] ; /** @var FieldGeneratorResolver $resolver */ $ resolver = GeneralUtility :: makeInstance ( FieldGeneratorResolver :: class ) ; foreach ( $ tca [ 'columns' ] as $ fieldName => $ fieldConfig ) { // Generate only if there is no value set, yet if ( isset ( $ fieldValues [ $ fieldName ] ) ) { continue ; } $ data = [ 'tableName' => $ tableName , 'fieldName' => $ fieldName , 'fieldConfig' => $ fieldConfig , 'fieldValues' => $ fieldValues , ] ; try { $ generator = $ resolver -> resolve ( $ data ) ; $ fieldValues [ $ fieldName ] = $ generator -> generate ( $ data ) ; } catch ( GeneratorNotFoundException $ e ) { // No op if no matching generator was found } } return $ fieldValues ; }
Generate data for a given table and insert into database

@param string $tableName The tablename to create data for
@param array $fieldValues Incoming list of field values, Typically uid and pid are set already
@return array
@throws Exception
Generate data for a given table and insert into database