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

PHPORM-232 Support whereLike and whereNotLike #3108

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
GromNaN merged 2 commits into mongodb:4.8 from GromNaN:PHPORM-232
Aug 26, 2024
Merged

Conversation

@GromNaN
Copy link
Member

@GromNaN GromNaN commented Aug 21, 2024

Fix PHPORM-232
Fix #3080

Checklist

  • Add tests and ensure they pass
  • Add an entry to the CHANGELOG.md file
  • Update documentation for new features

masterbater reacted with hooray emoji
@GromNaN GromNaN added this to the 4.8 milestone Aug 21, 2024
@GromNaN GromNaN requested a review from a team as a code owner August 21, 2024 15:31
@GromNaN GromNaN requested review from alcaeus and removed request for mana2-bot August 21, 2024 15:32
Comment on lines 751 to 779
yield 'whereLike' => [
['find' => [['name' => new Regex('^1$', 'i')], []]],
fn (Builder $builder) => $builder->whereLike('name', '1'),
];

yield 'whereLike case not sensitive' => [
['find' => [['name' => new Regex('^1$', 'i')], []]],
fn (Builder $builder) => $builder->whereLike('name', '1', false),
];

yield 'whereLike case sensitive' => [
['find' => [['name' => new Regex('^1$', '')], []]],
fn (Builder $builder) => $builder->whereLike('name', '1', true),
];

yield 'whereNotLike' => [
['find' => [['name' => ['$not' => new Regex('^1$', 'i')]], []]],
fn (Builder $builder) => $builder->whereNotLike('name', '1'),
];

yield 'whereNotLike case not sensitive' => [
['find' => [['name' => ['$not' => new Regex('^1$', 'i')]], []]],
fn (Builder $builder) => $builder->whereNotLike('name', '1', false),
];

yield 'whereNotLike case sensitive' => [
['find' => [['name' => ['$not' => new Regex('^1$', '')]], []]],
fn (Builder $builder) => $builder->whereNotLike('name', '1', true),
];
Copy link
Member Author

Choose a reason for hiding this comment

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


protected function compileWhereLike(array $where): array
{
$where['operator'] = $where['not'] ? 'not like' : 'like';
Copy link
Member Author

Choose a reason for hiding this comment

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

@GromNaN GromNaN merged commit 59e16b9 into mongodb:4.8 Aug 26, 2024
@GromNaN GromNaN deleted the PHPORM-232 branch August 26, 2024 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@alcaeus alcaeus alcaeus approved these changes

Assignees

No one assigned

Labels

Projects

None yet

Milestone

4.8

Development

Successfully merging this pull request may close these issues.

[Feature Request] Add whereLike clause to query builder

2 participants

AltStyle によって変換されたページ (->オリジナル) /