Skip to content

Commit 0e70cea

Browse files
committed
Replace depreciated getEntityManager with getManager
1 parent 24ffb52 commit 0e70cea

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/controller/PostGetAllAction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Request, Response} from "express";
2-
import {getEntityManager} from "typeorm";
2+
import {getManager} from "typeorm";
33
import {Post} from "../entity/Post";
44

55
/**
@@ -8,7 +8,7 @@ import {Post} from "../entity/Post";
88
export async function postGetAllAction(request: Request, response: Response) {
99

1010
// get a post repository to perform operations with post
11-
const postRepository = getEntityManager().getRepository(Post);
11+
const postRepository = getManager().getRepository(Post);
1212

1313
// load a post by a given post id
1414
const posts = await postRepository.find();

src/controller/PostGetByIdAction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Request, Response} from "express";
2-
import {getEntityManager} from "typeorm";
2+
import {getManager} from "typeorm";
33
import {Post} from "../entity/Post";
44

55
/**
@@ -8,7 +8,7 @@ import {Post} from "../entity/Post";
88
export async function postGetByIdAction(request: Request, response: Response) {
99

1010
// get a post repository to perform operations with post
11-
const postRepository = getEntityManager().getRepository(Post);
11+
const postRepository = getManager().getRepository(Post);
1212

1313
// load a post by a given post id
1414
const post = await postRepository.findOneById(request.params.id);

src/controller/PostSaveAction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Request, Response} from "express";
2-
import {getEntityManager} from "typeorm";
2+
import {getManager} from "typeorm";
33
import {Post} from "../entity/Post";
44

55
/**
@@ -8,7 +8,7 @@ import {Post} from "../entity/Post";
88
export async function postSaveAction(request: Request, response: Response) {
99

1010
// get a post repository to perform operations with post
11-
const postRepository = getEntityManager().getRepository(Post);
11+
const postRepository = getManager().getRepository(Post);
1212

1313
// create a real post object from post json object sent over http
1414
const newPost = postRepository.create(request.body);

0 commit comments

Comments
 (0)