Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[JsonPath] Add utils methodsfirst andlast toJsonPath builder#60188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
GromNaN merged 1 commit intosymfony:7.3fromalexandre-daubois:better-path-builder
Apr 10, 2025

Conversation

alexandre-daubois
Copy link
Member

@alexandre-dauboisalexandre-daubois commentedApr 9, 2025
edited
Loading

QA
Branch?7.3
Bug fix?no
New feature?yes
Deprecations?no
Issues-
LicenseMIT

Small DX improvements that goes with#60105 and#60083.

This PR adds two new methods,first() andlast(), added to JsonPath builder. This voluntary reminds methods from the DomCrawler component. The goal is not to add every possible method, but I thinkfirst() andlast() are common enough to be added.

I also propose to renameanyIndex() toall().

$path =newJsonPath();// Get the first user of the collection$path =$path->key('users')->first();
$path =newJsonPath();// Get the last user of the collection$path =$path->key('users')->last();
$path =newJsonPath();// Get all users of the collection$path =$path->key('users')->all();

@carsonbotcarsonbot added Status: Needs Review DXDX = Developer eXperience (anything that improves the experience of using Symfony) Feature JsonPath labelsApr 9, 2025
@carsonbotcarsonbot added this to the7.3 milestoneApr 9, 2025
@carsonbotcarsonbot changed the title[JsonPath][DX] Add utils methods toJsonPath builder[JsonPath] Add utils methods toJsonPath builderApr 9, 2025
@alexandre-dauboisalexandre-daubois changed the title[JsonPath] Add utils methods toJsonPath builder[JsonPath] Add two utils methods toJsonPath builderApr 9, 2025
Copy link
Member

@GromNaNGromNaN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Good idea, this names are the are commonly used in libraries.

@@ -43,11 +43,21 @@ public function deepScan(): static
return new self($this->path.'..');
}

public function anyIndex(): static
Copy link
Member

@GromNaNGromNaNApr 10, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

That's good that you renamed this method. Its name wasn't clear (to me).

@GromNaN
Copy link
Member

Thank you@alexandre-daubois.

@GromNaNGromNaN merged commitc16162f intosymfony:7.3Apr 10, 2025
6 of 11 checks passed
@GromNaNGromNaN changed the title[JsonPath] Add two utils methods toJsonPath builder[JsonPath] Add utils methodsfirst andlast toJsonPath builderApr 10, 2025
@fabpotfabpot mentioned this pull requestMay 2, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@GromNaNGromNaNGromNaN approved these changes

@mtarldmtarldmtarld approved these changes

Assignees
No one assigned
Labels
DXDX = Developer eXperience (anything that improves the experience of using Symfony)FeatureJsonPathStatus: Reviewed
Projects
None yet
Milestone
7.3
Development

Successfully merging this pull request may close these issues.

4 participants
@alexandre-daubois@GromNaN@mtarld@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp