Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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 doctrine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -751,13 +751,13 @@ the default convention.

If you need to get other information from the request to query the database, you
can also access the request in your expression thanks to the ``request``
variable. Let's say you pass the page limit of a list in a query parameter::
variable. Let's say you want the first or the last comment of a product depending on a query parameter named ``sort``::

#[Route('/product/{id}/comments')]
public function show(
Product $product,
#[MapEntity(expr: 'repository.findBy(["product_id" => id], null, request.query.get("limit", 10)')]
iterable $comments
#[MapEntity(expr: 'repository.findOneBy({"product": id}, {"createdAt": request.query.get("sort", "DESC")})')]
Comment $comment
): Response {
}

Expand Down