perf: prevent N+1 on watchlist fetch

This commit is contained in:
vinceh121
2025-11-02 03:12:46 +01:00
parent a1aec6b463
commit 0739ef5ca9
4 changed files with 45 additions and 19 deletions

View File

@@ -10,6 +10,7 @@ use ApiPlatform\Metadata\Patch;
use ApiPlatform\Metadata\Post;
use ApiPlatform\Metadata\Put;
use App\Repository\WatchlistRepository;
use App\State\MyWatchlistsProvider;
use App\State\WatchlistUpdateProcessor;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
@@ -25,7 +26,6 @@ use Symfony\Component\Validator\Constraints as Assert;
shortName: 'Watchlist',
operations: [
new GetCollection(
routeName: 'watchlist_get_all_mine',
normalizationContext: [
'groups' => [
'watchlist:list',
@@ -34,6 +34,7 @@ use Symfony\Component\Validator\Constraints as Assert;
],
],
name: 'get_all_mine',
provider: MyWatchlistsProvider::class,
),
new GetCollection(
uriTemplate: '/tracked',