Skip to content
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

collection: implement LIKE operator support #416

Merged
merged 1 commit into from
May 24, 2020
Merged

collection: implement LIKE operator support #416

merged 1 commit into from
May 24, 2020

Conversation

hrach
Copy link
Member

@hrach hrach commented May 8, 2020

No description provided.

@hrach hrach added this to the v4.0 milestone May 8, 2020
@hrach hrach linked an issue May 8, 2020 that may be closed by this pull request
@JanTvrdik
Copy link
Member

How about ~starts, ~ends and ~contains?

@hrach
Copy link
Member Author

hrach commented May 8, 2020

@JanTvrdik yes, definitely, if this form will be chosen.

@matej21 suggested something like 'column' => Expr::startsWith($foo), which is actually on my radar too because I'd like to support non-value expression on the right side.

@JanTvrdik
Copy link
Member

👍 for 'column' => Expr::startsWith($foo),

@hrach hrach force-pushed the like_function branch 2 times, most recently from f8e20cc to c7a9011 Compare May 24, 2020 11:48
@hrach
Copy link
Member Author

hrach commented May 24, 2020

The final chosen syntax:

...->findBy(['title~' => LikeExpression::raw('Book%')]);
...->findBy(['title~' => LikeExpression::startsWith('Book')]);
...->findBy(['title~' => LikeExpression::endsWith('Book')]);
...->findBy(['title~' => LikeExpression::contains('Book')]);

@hrach hrach merged commit aa9141a into master May 24, 2020
@hrach hrach deleted the like_function branch May 24, 2020 12:00
This was referenced May 24, 2020
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.

Consider (reconsider) LIKE function
2 participants