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

Added warning about query cache in relation to parameters #10276

Merged
merged 4 commits into from
Dec 24, 2022
Merged
Changes from 2 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
9 changes: 5 additions & 4 deletions docs/en/reference/filters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ table alias of the SQL table of the entity.
In the case of joined or single table inheritance, you always get passed the ClassMetadata of the
inheritance root. This is necessary to avoid edge cases that would break the SQL when applying the filters.

Parameters for the query should be set on the filter object by
``SQLFilter#setParameter()``. Only parameters set via this function can be used
in filters. The ``SQLFilter#getParameter()`` function takes care of the
proper quoting of parameters.
For the filter to correctly function the following rules must be followed, failure to do so will lead to unexpected results from the query cache.
antman3351 marked this conversation as resolved.
Show resolved Hide resolved
1. Parameters for the query should be set on the filter object by ``SQLFilter#setParameter()`` before the filter is used by the ORM ( i.e. do not set parameters inside ``SQLFilter#addFilterConstraint()`` function ).
2. The filter must be detrimistic. Don't cahange the values base on external inputs.
antman3351 marked this conversation as resolved.
Show resolved Hide resolved

The ``SQLFilter#getParameter()`` function takes care of the proper quoting of parameters.

.. code-block:: php

Expand Down