Version: 4.3

Class: Configuration<D>

Type parameters

NameTypeDefault
DIDatabaseDriverIDatabaseDriver

Hierarchy

  • Configuration

Constructors

constructor

+ new Configuration(options: Options, validate?: boolean): Configuration

Defined in packages/core/src/utils/Configuration.ts:97

Parameters:

NameTypeDefault value
optionsOptions-
validatebooleantrue

Returns: Configuration

Properties

cache

Private Readonly cache: Dictionary

Defined in packages/core/src/utils/Configuration.ts:97


driver

Private Readonly driver: D

Defined in packages/core/src/utils/Configuration.ts:95


logger

Private Readonly logger: Logger

Defined in packages/core/src/utils/Configuration.ts:94


options

Private Readonly options: MikroORMOptions<D>

Defined in packages/core/src/utils/Configuration.ts:93


platform

Private Readonly platform: Platform

Defined in packages/core/src/utils/Configuration.ts:96

Methods

cached

Privatecached<T>(cls: T, ...args: ConstructorParameters<T>): InstanceType<T>

Defined in packages/core/src/utils/Configuration.ts:268

Type parameters:

NameType
T{ constructor: (...args: any[]) => InstanceType<T> }

Parameters:

NameType
clsT
...argsConstructorParameters<T>

Returns: InstanceType<T>


get

get<T, U>(key: T, defaultValue?: U): U

Defined in packages/core/src/utils/Configuration.ts:117

Gets specific configuration option. Falls back to specified defaultValue if provided.

Type parameters:

NameType
Tkeyof MikroORMOptions<D>
UMikroORMOptions<D>[T]

Parameters:

NameType
keyT
defaultValue?U

Returns: U


getCacheAdapter

getCacheAdapter(): CacheAdapter

Defined in packages/core/src/utils/Configuration.ts:184

Gets instance of CacheAdapter. (cached)

Returns: CacheAdapter


getClientUrl

getClientUrl(hidePassword?: boolean): string

Defined in packages/core/src/utils/Configuration.ts:145

Gets current client URL (connection string).

Parameters:

NameTypeDefault value
hidePasswordbooleanfalse

Returns: string


getDriver

getDriver(): D

Defined in packages/core/src/utils/Configuration.ts:156

Gets current database driver instance.

Returns: D


getHydrator

getHydrator(metadata: MetadataStorage): IHydrator

Defined in packages/core/src/utils/Configuration.ts:170

Gets instance of Hydrator.

Parameters:

NameType
metadataMetadataStorage

Returns: IHydrator


getLogger

getLogger(): Logger

Defined in packages/core/src/utils/Configuration.ts:138

Gets Logger instance.

Returns: Logger


getMetadataProvider

getMetadataProvider(): MetadataProvider

Defined in packages/core/src/utils/Configuration.ts:177

Gets instance of MetadataProvider. (cached)

Returns: MetadataProvider


getNamingStrategy

getNamingStrategy(): NamingStrategy

Defined in packages/core/src/utils/Configuration.ts:163

Gets instance of NamingStrategy. (cached)

Returns: NamingStrategy


getRepositoryClass

getRepositoryClass(customRepository: EntityOptions<any>["customRepository"]): MikroORMOptions<D>["entityRepository"]

Defined in packages/core/src/utils/Configuration.ts:198

Gets EntityRepository class to be instantiated.

Parameters:

NameType
customRepositoryEntityOptions<any>["customRepository"]

Returns: MikroORMOptions<D>["entityRepository"]


getResultCacheAdapter

getResultCacheAdapter(): CacheAdapter

Defined in packages/core/src/utils/Configuration.ts:191

Gets instance of CacheAdapter for result cache. (cached)

Returns: CacheAdapter


init

Privateinit(): void

Defined in packages/core/src/utils/Configuration.ts:210

Returns: void


initDriver

PrivateinitDriver(): D

Defined in packages/core/src/utils/Configuration.ts:259

Returns: D


reset

reset<T, U>(key: T): void

Defined in packages/core/src/utils/Configuration.ts:131

Resets the configuration to its default value

Type parameters:

NameType
Tkeyof MikroORMOptions<D>
UMikroORMOptions<D>[T]

Parameters:

NameType
keyT

Returns: void


set

set<T, U>(key: T, value: U): void

Defined in packages/core/src/utils/Configuration.ts:124

Overrides specified configuration value.

Type parameters:

NameType
Tkeyof MikroORMOptions<D>
UMikroORMOptions<D>[T]

Parameters:

NameType
keyT
valueU

Returns: void


validateOptions

PrivatevalidateOptions(): void

Defined in packages/core/src/utils/Configuration.ts:245

Returns: void

Object literals

DEFAULTS

Static Readonly DEFAULTS: object

Defined in packages/core/src/utils/Configuration.ts:27

Properties:

NameTypeValue
autoJoinOneToOneOwnerbooleantrue
baseDirstringprocess.cwd()
batchSizenumber300
contextNamestring"default"
debugbooleanfalse
driverOptionsobject{}
ensureIndexesbooleanfalse
entitiesundefined[][]
entitiesTsundefined[][]
filtersobject{}
forceUndefinedbooleanfalse
forceUtcTimezonebooleanfalse
highlighterNullHighlighternew NullHighlighter()
hydratorObjectHydratorObjectHydrator
loadStrategyLoadStrategyLoadStrategy.SELECT_IN
loggeranyconsole.log.bind(console)
metadataProviderReflectMetadataProviderReflectMetadataProvider
poolobject{}
populateAfterFlushbooleanfalse
propagateToOneOwnerbooleantrue
strictbooleanfalse
subscribersundefined[][]
validatebooleanfalse
verbosebooleanfalse
contextfunction(name: string) => EntityManager<IDatabaseDriver<Connection>>
findOneOrFailHandlerfunction(entityName: string, where: Dictionary | IPrimaryKey) => NotFoundError<AnyEntity<any>>
cacheobject{ adapter: FileCacheAdapter = FileCacheAdapter; pretty: boolean = false; options: { cacheDir: string = process.cwd() + '/temp' } }
discoveryobject{ alwaysAnalyseProperties: boolean = true; disableDynamicFileAccess: boolean = false; requireEntitiesArray: boolean = false; warnWhenNoEntities: boolean = true }
migrationsobject{ allOrNothing: boolean = true; disableForeignKeys: boolean = true; dropTables: boolean = true; emit: string = "ts"; path: string = "./migrations"; pattern: RegExp = /^[\w-]+\d+.ts$/; safe: boolean = false; tableName: string = "mikro_orm_migrations"; transactional: boolean = true; fileName: (timestamp: string) => string }
resultCacheobject{ adapter: MemoryCacheAdapter = MemoryCacheAdapter; expiration: number = 1000; options: {} }

PLATFORMS

Static Readonly PLATFORMS: object

Defined in packages/core/src/utils/Configuration.ts:85

Properties:

NameTypeValue
mariadbobject{ className: string = "MariaDbDriver"; module: () => any }
mongoobject{ className: string = "MongoDriver"; module: () => any }
mysqlobject{ className: string = "MySqlDriver"; module: () => any }
postgresqlobject{ className: string = "PostgreSqlDriver"; module: () => any }
sqliteobject{ className: string = "SqliteDriver"; module: () => any }
Last updated on by Martin Adámek