Skip to content

Commit 1c8ff8b

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: [Doctrine] Fix #[MapEntity(expr: '...')]
2 parents ea5a5b9 + 44ea4d5 commit 1c8ff8b

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
@@ -747,13 +747,13 @@ the default convention.
747747

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

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

0 commit comments

Comments
 (0)