setTable(determineTableName('api_keys', $emConfig)) ->setCustomRepositoryClass(ApiKey\Repository\ApiKeyRepository::class); $builder->createField('id', Types::BIGINT) ->makePrimaryKey() ->generatedValue('IDENTITY') ->option('unsigned', true) ->build(); $builder->createField('key', Types::STRING) ->columnName('`key`') ->unique() ->build(); $builder->createField('name', Types::STRING) ->columnName('`name`') ->nullable() ->build(); $builder->createField('expirationDate', ChronosDateTimeType::CHRONOS_DATETIME) ->columnName('expiration_date') ->nullable() ->build(); $builder->createField('enabled', Types::BOOLEAN) ->build(); $builder->createOneToMany('roles', ApiKeyRole::class) ->mappedBy('apiKey') ->setIndexBy('roleName') ->cascadePersist() ->orphanRemoval() ->build(); };