Skip to content

Commit

Permalink
docs: minor text corrections (#5571)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescoBorzi committed May 15, 2024
1 parent ffd6ea3 commit 9485daa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/docs/guide/04-advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ const res2 = await qb.execute('get'); // returns single object
const res3 = await qb.execute('run'); // returns object like `{ affectedRows: number, insertId: number, row: any }`
```

Second argument can be used to disable mapping of database columns to property namesIn following example, `Article` entity has `createdAt` property defined with implicit underscored field name `created_at`:
The second argument can be used to disable the mapping of database columns to property names. In the following example, the `Article` entity has a `createdAt` property defined with implicit underscored field name `created_at`:

```ts
const res1 = await em.createQueryBuilder(Article).select('*').execute('get', true);
Expand All @@ -933,7 +933,7 @@ const res2 = await em.createQueryBuilder(Article).select('*').execute('get', fal
console.log(res2); // `created_at` will be defined, while `createdAt` will be missing
```

To get entity instances from the `QueryBuilder` result, you can use `getResult()` and `getSingleResult()` methods:
To get the entity instances from the `QueryBuilder` result, you can use the `getResult()` and `getSingleResult()` methods:

```ts
const article = await em.createQueryBuilder(Article)
Expand All @@ -952,7 +952,7 @@ console.log(articles[0] instanceof Article); // true
### Awaiting the QueryBuilder

You can also await the `QueryBuilder` instance, which will automatically execute the `QueryBuilder` and return appropriate response automatically. The `QueryBuilder` instance is typed based on usage of `select/insert/update/delete/truncate` methods to one of:
You can also await the `QueryBuilder` instance, which will automatically execute the `QueryBuilder` and return an appropriate response automatically. The `QueryBuilder` instance is typed based on the usage of `select/insert/update/delete/truncate` methods to one of:

- `SelectQueryBuilder`
- awaiting yields array of entities (as `qb.getResultList()`)
Expand Down

0 comments on commit 9485daa

Please sign in to comment.