Skip to content

Commit 3f5f724

Browse files
janedbalondrejmirtes
authored andcommitted
Readme: add reportDynamicQueryBuilders
1 parent e25daa3 commit 3f5f724

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,20 @@ $query->getOneOrNullResult(Query::HYDRATE_OBJECT); // User
152152

153153
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.
154154

155+
### Problematic approaches
156+
157+
Not every QueryBuilder can be statically analysed, here are few advices to maximize type inferring:
158+
- Do not pass QueryBuilder to methods
159+
- Do not use dynamic expressions in QueryBuilder methods (mainly in `select`/`join`/`from`/`set`)
160+
161+
You can enable reporting of places where inferring is unavailable by:
162+
163+
```neon
164+
parameters:
165+
doctrine:
166+
reportDynamicQueryBuilders: true
167+
```
168+
155169
## Custom types
156170

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

0 commit comments

Comments
 (0)