Skip to content

Commit a5c0590

Browse files
committed
Updates
1 parent fb07b32 commit a5c0590

4 files changed

Lines changed: 37 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [2.0.0] - xxxx-xx-xx
99

10+
### Added
11+
12+
- `ExpressionValues` to enable resolution of route parameter values via expressions by @HypeMC
13+
in https://github.com/sofascore/purgatory-bundle/pull/112
14+
1015
### Removed
1116

1217
- Symfony v5 support by @HypeMC in https://github.com/sofascore/purgatory-bundle/pull/128
18+
- `InverseValuesAwareInterface`, use dedicated builder services instead by @HypeMC
19+
in https://github.com/sofascore/purgatory-bundle/pull/123
1320

1421
## [1.3.0] - 2025-12-15
1522

src/Cache/PropertyResolver/ExpressionLanguage/InverseRelationExpressionTransformer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
use Symfony\Component\PropertyInfo\PropertyReadInfo;
1010
use Symfony\Component\PropertyInfo\PropertyReadInfoExtractorInterface;
1111

12+
/**
13+
* @internal
14+
*/
1215
final class InverseRelationExpressionTransformer
1316
{
1417
public function __construct(

tests/Command/DebugCommandTest.php

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function testOptionAll(): void
5656

5757
self::assertNumberOfDisplayedSubscriptions(
5858
command: $this->command,
59-
expectedNumberOfSubscriptions: 10,
59+
expectedNumberOfSubscriptions: 12,
6060
);
6161
self::assertNumberOfDisplayedEntities(
6262
command: $this->command,
@@ -65,7 +65,7 @@ public function testOptionAll(): void
6565
);
6666
self::assertNumberOfDisplayedEntities(
6767
command: $this->command,
68-
expectedNumberOfEntities: 5,
68+
expectedNumberOfEntities: 7,
6969
entityClass: Author::class,
7070
);
7171

@@ -96,6 +96,11 @@ public function testOptionAll(): void
9696
needle: 'page: Dynamic("purgatory.get_page", null)',
9797
haystack: $display,
9898
);
99+
self::assertSubstringCount(
100+
expectedCount: 2,
101+
needle: 'full_name: Expression("obj.firstName~\"-\"~obj.lastName")',
102+
haystack: $display,
103+
);
99104
}
100105

101106
public function testOptionRoute(): void
@@ -134,7 +139,7 @@ public function testOptionRoute(): void
134139

135140
#[TestWith([Post::class, 1, Post::class, 'ANY'])]
136141
#[TestWith([Author::class, 1, Author::class, 'ANY'])]
137-
#[TestWith([Author::class.'::firstName', 2, Author::class, 'firstName'])]
142+
#[TestWith([Author::class.'::firstName', 3, Author::class, 'firstName'])]
138143
public function testOptionSubscription(string $subscriptionOption, int $numberOfSubscriptions, string $entity, string $property): void
139144
{
140145
$this->command->execute([
@@ -170,11 +175,11 @@ public function testOptionSubscriptionWithProperties(): void
170175

171176
self::assertNumberOfDisplayedSubscriptions(
172177
command: $this->command,
173-
expectedNumberOfSubscriptions: 5,
178+
expectedNumberOfSubscriptions: 7,
174179
);
175180
self::assertNumberOfDisplayedEntities(
176181
command: $this->command,
177-
expectedNumberOfEntities: 5,
182+
expectedNumberOfEntities: 7,
178183
entityClass: Author::class,
179184
);
180185
}
@@ -191,12 +196,12 @@ public function testInteractiveMode(): void
191196

192197
self::assertNumberOfDisplayedEntities(
193198
command: $this->command,
194-
expectedNumberOfEntities: 2,
199+
expectedNumberOfEntities: 3,
195200
entityClass: Author::class,
196201
);
197202
self::assertNumberOfDisplayedProperties(
198203
command: $this->command,
199-
expectedNumberOfProperties: 2,
204+
expectedNumberOfProperties: 3,
200205
property: 'lastName',
201206
);
202207
}
@@ -213,7 +218,7 @@ public function testInteractiveModeWithAllProperties(): void
213218

214219
self::assertNumberOfDisplayedEntities(
215220
command: $this->command,
216-
expectedNumberOfEntities: 5,
221+
expectedNumberOfEntities: 7,
217222
entityClass: Author::class,
218223
);
219224
self::assertNumberOfDisplayedProperties(
@@ -223,12 +228,12 @@ public function testInteractiveModeWithAllProperties(): void
223228
);
224229
self::assertNumberOfDisplayedProperties(
225230
command: $this->command,
226-
expectedNumberOfProperties: 2,
231+
expectedNumberOfProperties: 3,
227232
property: 'firstName',
228233
);
229234
self::assertNumberOfDisplayedProperties(
230235
command: $this->command,
231-
expectedNumberOfProperties: 2,
236+
expectedNumberOfProperties: 3,
232237
property: 'lastName',
233238
);
234239
}

tests/Functional/DebugCommand/Controller/PostController.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Sofascore\PurgatoryBundle\Attribute\RouteParamValue\CompoundValues;
99
use Sofascore\PurgatoryBundle\Attribute\RouteParamValue\DynamicValues;
1010
use Sofascore\PurgatoryBundle\Attribute\RouteParamValue\EnumValues;
11+
use Sofascore\PurgatoryBundle\Attribute\RouteParamValue\ExpressionValues;
1112
use Sofascore\PurgatoryBundle\Attribute\RouteParamValue\RawValues;
1213
use Sofascore\PurgatoryBundle\Attribute\Target\ForGroups;
1314
use Sofascore\PurgatoryBundle\Listener\Enum\Action;
@@ -73,4 +74,15 @@ public function list()
7374
public function filterByAuthorAndTag(Author $author)
7475
{
7576
}
77+
78+
#[Route('/author-full-name/{full_name}', 'post_filter_by_author_full_name')]
79+
#[PurgeOn(Author::class,
80+
target: ['firstName', 'lastName'],
81+
routeParams: [
82+
'full_name' => new ExpressionValues('obj.firstName~"-"~obj.lastName'),
83+
],
84+
)]
85+
public function filterByAuthorFullName()
86+
{
87+
}
7688
}

0 commit comments

Comments
 (0)