Open
Description
Description
Currently we can do this:
#[Route('/{author_id}', name: 'app_test')]
public function index(
#[MapEntity(class: Post::class, expr: 'repository.findBy({"author": author_id}, {}, 10)')]
iterable $posts
): Response {
// ...
}
It would be interesting to be able to integrate the current user
into EntityValueResolver
's expression
#[Route('/my-posts', name: 'app_my_posts')]
public function index(
#[MapEntity(class: Post::class, expr: 'repository.findBy({"author": user}, {}, 10)')]
iterable $posts
): Response {
// ...
}
This will also allow you to modify symfony/demo and use #[MapEntity]
for the example below: