Skip to content

Commit c1e2102

Browse files
committed
Merge branch '7.0' into 7.1
* 7.0: [Doctrine] Fix #[MapEntity(expr: '...')]
2 parents 50a296f + 1c8ff8b commit c1e2102

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

doctrine.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -748,13 +748,13 @@ the default convention.
748748

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

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

0 commit comments

Comments
 (0)