Skip to main content
Version: 4.5

Class: Configuration<D>#

core.Configuration

Type parameters#

NameTypeDefault
DIDatabaseDriverIDatabaseDriver

Constructors#

constructor#

+ new Configuration<D>(options: Options<IDatabaseDriver<Connection>>, validate?: boolean): Configuration<D>

Type parameters:#

NameTypeDefault
DIDatabaseDriver<Connection, D>IDatabaseDriver<Connection>

Parameters:#

NameTypeDefault value
optionsOptions<IDatabaseDriver<Connection>>-
validatebooleantrue

Returns: Configuration<D>

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

Properties#

cache#

Private Readonly cache: Dictionary<any>

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


driver#

Private Readonly driver: D

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


logger#

Private Readonly logger: Logger

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


options#

Private Readonly options: MikroORMOptions<D>

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


platform#

Private Readonly platform: Platform

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


DEFAULTS#

Readonly Static DEFAULTS: object

Type declaration:#

NameType
autoJoinOneToOneOwnerboolean
baseDirstring
batchSizenumber
cacheobject
cache.adaptertypeof FileCacheAdapter
cache.optionsobject
cache.options.cacheDirstring
cache.prettyboolean
context(name: string) => undefined | EntityManager<IDatabaseDriver<Connection>>
contextNamestring
debugboolean
discoveryobject
discovery.alwaysAnalysePropertiesboolean
discovery.disableDynamicFileAccessboolean
discovery.requireEntitiesArrayboolean
discovery.warnWhenNoEntitiesboolean
driverOptionsobject
ensureIndexesboolean
entitiesnever[]
entitiesTsnever[]
filtersobject
findOneOrFailHandler(entityName: string, where: IPrimaryKeyValue | Dictionary<any>) => NotFoundError<AnyEntity<any>>
forceEntityConstructorboolean
forceUndefinedboolean
forceUtcTimezoneboolean
highlighterNullHighlighter
hydratortypeof ObjectHydrator
loadStrategyLoadStrategy
logger(...data: any[]) => void(message?: any, ...optionalParams: any[]) => void
metadataProvidertypeof ReflectMetadataProvider
migrationsobject
migrations.allOrNothingboolean
migrations.disableForeignKeysboolean
migrations.dropTablesboolean
migrations.emitstring
migrations.fileName(timestamp: string) => string
migrations.pathstring
migrations.patternRegExp
migrations.safeboolean
migrations.tableNamestring
migrations.transactionalboolean
poolobject
populateAfterFlushboolean
propagateToOneOwnerboolean
resultCacheobject
resultCache.adaptertypeof MemoryCacheAdapter
resultCache.expirationnumber
resultCache.optionsobject
strictboolean
subscribersnever[]
validateboolean
verboseboolean

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


PLATFORMS#

Readonly Static PLATFORMS: object

Type declaration:#

NameType
mariadbobject
mariadb.classNamestring
mariadb.module() => any
mongoobject
mongo.classNamestring
mongo.module() => any
mysqlobject
mysql.classNamestring
mysql.module() => any
postgresqlobject
postgresql.classNamestring
postgresql.module() => any
sqliteobject
sqlite.classNamestring
sqlite.module() => any

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

Methods#

cached#

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

Type parameters:#

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

Parameters:#

NameType
clsT
...argsConstructorParameters<T>

Returns: InstanceType<T>

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


get#

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

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

Type parameters:#

NameType
Tkeyof MikroORMOptions<D>
Uundefined | string | number | boolean | Dictionary<any> | Highlighter | () => NamingStrategy | Constructor<EntityRepository<any>> | Partial<ConnectionOptions>[] | (string | EntityClass<AnyEntity<any>> | EntityClassGroup<AnyEntity<any>> | EntitySchema<any, undefined>)[] | EventSubscriber<any>[] | Dictionary<{ name?: string } & Omit<FilterDef<AnyEntity<any>>, name>> | { alwaysAnalyseProperties?: boolean ; disableDynamicFileAccess?: boolean ; requireEntitiesArray?: boolean ; warnWhenNoEntities?: boolean } | (config: Configuration<IDatabaseDriver<Connection>>) => D | (string | Constructor<AnyEntity<any>>)[] | HydratorConstructor | (name: string) => undefined | EntityManager<IDatabaseDriver<Connection>> | (message: string) => void | (entityName: string, where: IPrimaryKeyValue | Dictionary<any>) => Error | LoggerNamespace[] | MigrationsOptions | { adapter?: (...params: any[]) => CacheAdapter ; enabled?: boolean ; options?: Dictionary<any> ; pretty?: boolean } | { adapter?: (...params: any[]) => CacheAdapter ; expiration?: number ; options?: Dictionary<any> } | (config: Configuration<IDatabaseDriver<Connection>>) => MetadataProvider | PoolConfig

Parameters:#

NameType
keyT
defaultValue?U

Returns: U

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


getAll#

getAll(): MikroORMOptions<D>

Returns: MikroORMOptions<D>

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


getCacheAdapter#

getCacheAdapter(): CacheAdapter

Gets instance of CacheAdapter. (cached)

Returns: CacheAdapter

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


getClientUrl#

getClientUrl(hidePassword?: boolean): string

Gets current client URL (connection string).

Parameters:#

NameTypeDefault value
hidePasswordbooleanfalse

Returns: string

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


getDriver#

getDriver(): D

Gets current database driver instance.

Returns: D

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


getHydrator#

getHydrator(metadata: MetadataStorage): IHydrator

Gets instance of Hydrator.

Parameters:#

NameType
metadataMetadataStorage

Returns: IHydrator

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


getLogger#

getLogger(): Logger

Gets Logger instance.

Returns: Logger

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


getMetadataProvider#

getMetadataProvider(): MetadataProvider

Gets instance of MetadataProvider. (cached)

Returns: MetadataProvider

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


getNamingStrategy#

getNamingStrategy(): NamingStrategy

Gets instance of NamingStrategy. (cached)

Returns: NamingStrategy

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


getRepositoryClass#

getRepositoryClass(customRepository: undefined | () => Constructor<EntityRepository<any>>): undefined | Constructor<EntityRepository<any>>

Gets EntityRepository class to be instantiated.

Parameters:#

NameType
customRepositoryundefined | () => Constructor<EntityRepository<any>>

Returns: undefined | Constructor<EntityRepository<any>>

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


getResultCacheAdapter#

getResultCacheAdapter(): CacheAdapter

Gets instance of CacheAdapter for result cache. (cached)

Returns: CacheAdapter

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


init#

Privateinit(): void

Returns: void

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


initDriver#

PrivateinitDriver(): D

Returns: D

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


reset#

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

Resets the configuration to its default value

Type parameters:#

NameType
Tkeyof MikroORMOptions<D>
Uundefined | string | number | boolean | Dictionary<any> | Highlighter | () => NamingStrategy | Constructor<EntityRepository<any>> | Partial<ConnectionOptions>[] | (string | EntityClass<AnyEntity<any>> | EntityClassGroup<AnyEntity<any>> | EntitySchema<any, undefined>)[] | EventSubscriber<any>[] | Dictionary<{ name?: string } & Omit<FilterDef<AnyEntity<any>>, name>> | { alwaysAnalyseProperties?: boolean ; disableDynamicFileAccess?: boolean ; requireEntitiesArray?: boolean ; warnWhenNoEntities?: boolean } | (config: Configuration<IDatabaseDriver<Connection>>) => D | (string | Constructor<AnyEntity<any>>)[] | HydratorConstructor | (name: string) => undefined | EntityManager<IDatabaseDriver<Connection>> | (message: string) => void | (entityName: string, where: IPrimaryKeyValue | Dictionary<any>) => Error | LoggerNamespace[] | MigrationsOptions | { adapter?: (...params: any[]) => CacheAdapter ; enabled?: boolean ; options?: Dictionary<any> ; pretty?: boolean } | { adapter?: (...params: any[]) => CacheAdapter ; expiration?: number ; options?: Dictionary<any> } | (config: Configuration<IDatabaseDriver<Connection>>) => MetadataProvider | PoolConfig

Parameters:#

NameType
keyT

Returns: void

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


set#

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

Overrides specified configuration value.

Type parameters:#

NameType
Tkeyof MikroORMOptions<D>
Uundefined | string | number | boolean | Dictionary<any> | Highlighter | () => NamingStrategy | Constructor<EntityRepository<any>> | Partial<ConnectionOptions>[] | (string | EntityClass<AnyEntity<any>> | EntityClassGroup<AnyEntity<any>> | EntitySchema<any, undefined>)[] | EventSubscriber<any>[] | Dictionary<{ name?: string } & Omit<FilterDef<AnyEntity<any>>, name>> | { alwaysAnalyseProperties?: boolean ; disableDynamicFileAccess?: boolean ; requireEntitiesArray?: boolean ; warnWhenNoEntities?: boolean } | (config: Configuration<IDatabaseDriver<Connection>>) => D | (string | Constructor<AnyEntity<any>>)[] | HydratorConstructor | (name: string) => undefined | EntityManager<IDatabaseDriver<Connection>> | (message: string) => void | (entityName: string, where: IPrimaryKeyValue | Dictionary<any>) => Error | LoggerNamespace[] | MigrationsOptions | { adapter?: (...params: any[]) => CacheAdapter ; enabled?: boolean ; options?: Dictionary<any> ; pretty?: boolean } | { adapter?: (...params: any[]) => CacheAdapter ; expiration?: number ; options?: Dictionary<any> } | (config: Configuration<IDatabaseDriver<Connection>>) => MetadataProvider | PoolConfig

Parameters:#

NameType
keyT
valueU

Returns: void

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


validateOptions#

PrivatevalidateOptions(): void

Returns: void

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

Last updated on by Renovate Bot