Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: minor text corrections #5571

Merged
merged 2 commits into from
May 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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