Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
Commitc16162f
committed
feature#60188 [JsonPath] Add two utils methods to
This PR was merged into the 7.3 branch.Discussion----------[JsonPath] Add two utils methods to `JsonPath` builder| Q | A| ------------- | ---| Branch? | 7.3| Bug fix? | no| New feature? | yes| Deprecations? | no| Issues | -| License | MITSmall DX improvements that goes with#60105 and#60083.This PR adds two new methods, `first()` and `last()`, added to JsonPath builder. This voluntary reminds methods from the DomCrawler component. The goal is not to add every possible method, but I think `first()` and `last()` are common enough to be added.I also propose to rename `anyIndex()` to `all()`.```php$path = new JsonPath();// Get the first user of the collection$path = $path->key('users')->first();``````php$path = new JsonPath();// Get the last user of the collection$path = $path->key('users')->last();``````php$path = new JsonPath();// Get all users of the collection$path = $path->key('users')->all();```Commits-------3bc3559 [JsonPath][DX] Add utils methods to `JsonPath` builderJsonPath
builder (alexandre-daubois)File tree
2 files changed
+38
-1
lines changed- src/Symfony/Component/JsonPath
- Tests
2 files changed
+38
-1
lines changedLines changed: 11 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
43 | 43 |
| |
44 | 44 |
| |
45 | 45 |
| |
46 |
| - | |
| 46 | + | |
47 | 47 |
| |
48 | 48 |
| |
49 | 49 |
| |
50 | 50 |
| |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
51 | 61 |
| |
52 | 62 |
| |
53 | 63 |
| |
|
Lines changed: 27 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
35 | 35 |
| |
36 | 36 |
| |
37 | 37 |
| |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
38 | 65 |
|
0 commit comments
Comments
(0)