Skip to content

Allow reading target groups from #[Serialize] - #154

Merged
HypeMC merged 2 commits into
sofascore:1.xfrom
HypeMC:forresponsegroups
Sep 18, 2026
Merged

HypeMC merged 2 commits into
sofascore:1.xfrom
HypeMC:forresponsegroups

Conversation

@HypeMC

@HypeMC HypeMC commented Sep 17, 2026

Copy link
Copy Markdown
Member

Summary 📝

This PR adds a new ForResponseGroups target that reads serialization groups from Symfony's #[Serialize] attribute.

This allows the purge target to reuse the same groups that are already configured for serializing the controller response, instead of having to duplicate them in ForGroups.

For example:

#[PurgeOn(Post::class, target: new ForResponseGroups())]
#[Serialize(context: ['groups' => ['foo', 'bar']])]
public function action(): Response {}

is equivalent to:

#[PurgeOn(Post::class, target: new ForGroups(['foo', 'bar']))]
#[Serialize(context: ['groups' => ['foo', 'bar']])]
public function action(): Response {}

This builds on the #[Serialize] controller attribute introduced in Symfony 8.1.

Checklist ✅

  • Tests updated 🐛
  • Docs updated 📚
  • Changelog updated 📋
  • Breaking change ⚠️

@HypeMC
HypeMC changed the base branch from 2.x to 1.x September 17, 2026 21:16
@HypeMC HypeMC self-assigned this Sep 17, 2026
@codecov

codecov Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.48%. Comparing base (8ab7ef0) to head (c232d28).

Additional details and impacted files
@@             Coverage Diff              @@
##                1.x     #154      +/-   ##
============================================
+ Coverage     97.44%   97.48%   +0.04%     
- Complexity      508      522      +14     
============================================
  Files            63       65       +2     
  Lines          1409     1432      +23     
============================================
+ Hits           1373     1396      +23     
  Misses           36       36              
Flag Coverage Δ
8.1 96.22% <21.73%> (-1.22%) ⬇️
8.2 96.15% <21.73%> (-1.22%) ⬇️
8.3 95.94% <21.73%> (-1.22%) ⬇️
8.4 97.20% <100.00%> (+0.04%) ⬆️
8.5 97.20% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Brajk19
Brajk19 previously approved these changes Sep 18, 2026
Comment thread src/Cache/TargetResolver/ForResponseGroupsResolver.php Outdated
@HypeMC
HypeMC merged commit a2481de into sofascore:1.x Sep 18, 2026
37 checks passed
@HypeMC
HypeMC deleted the forresponsegroups branch September 18, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants