1
0
forked from noxious/server

OOP is my passion ( ͡° ͜ʖ ͡°)

This commit is contained in:
2025-01-04 18:35:53 +01:00
parent 0b4420f956
commit 067976c54a
46 changed files with 165 additions and 164 deletions

View File

@@ -6,8 +6,12 @@ import Logger, { LoggerType } from '#application/logger'
export abstract class BaseRepository {
protected readonly logger = Logger.type(LoggerType.REPOSITORY)
private entityManager?: EntityManager
protected get em(): EntityManager {
return Database.getEntityManager()
getEntityManager(): EntityManager {
if (!this.entityManager) {
this.entityManager = Database.getORM().em.fork()
}
return this.entityManager
}
}