Skip to content

Commit

Permalink
Readme: add reportDynamicQueryBuilders
Browse files Browse the repository at this point in the history
  • Loading branch information
janedbal authored and ondrejmirtes committed Jan 24, 2024
1 parent e25daa3 commit 3f5f724
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,20 @@ $query->getOneOrNullResult(Query::HYDRATE_OBJECT); // User

This is due to the design of the `Query` class preventing from determining the hydration mode used by these functions unless it is specified explicitly during the call.

### Problematic approaches

Not every QueryBuilder can be statically analysed, here are few advices to maximize type inferring:
- Do not pass QueryBuilder to methods
- Do not use dynamic expressions in QueryBuilder methods (mainly in `select`/`join`/`from`/`set`)

You can enable reporting of places where inferring is unavailable by:

```neon
parameters:
doctrine:
reportDynamicQueryBuilders: true
```

## Custom types

If your application uses custom Doctrine types, you can write your own type descriptors to analyse them properly.
Expand Down

0 comments on commit 3f5f724

Please sign in to comment.