Open chimon2000 opened 7 years ago
I have a modified version of the express example that uses the latest version. When referencing the entity class
photos = await getEntityManager().getRepository(Photo).find()
I receive an error, however when using the entity string "Photo"
photos = await getEntityManager().getRepository("Photo").find()
everything works fine. This only occurs inside of the controller class. If I move the same code into the createConnection callback, everything works fine:
createConnection
createConnection({ ...configuration }) .then(connection => { const repo = getEntityManager().getRepository(Photo).find().then(console.log) // const app = express() // app.use(bodyParser.json()) // routes.forEach(route => { // app[route.method](route.path, (request: Request, response: Response, next: Function) => { // route.action(request, response).then(() => next).catch(err => next(err)) // }) // }) // app.listen(3000) })
I have a modified version of the express example that uses the latest version. When referencing the entity class
I receive an error, however when using the entity string "Photo"
everything works fine. This only occurs inside of the controller class. If I move the same code into the
createConnection
callback, everything works fine: