-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
New PSR for data querying #1284
base: master
Are you sure you want to change the base?
Conversation
Interesting. We have a different approach to similar problem at Yii: https://github.com/yiisoft/data |
@samdark I really like how you managed filters! This is a great way to do this I didn't think of! |
proposed/query.md
Outdated
* | ||
* @return QueryInterface | ||
*/ | ||
public static function from(iterable $source, QueryContextInterface $context = null): QueryInterface; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public static function from(iterable $source, QueryContextInterface $context = null): QueryInterface; | |
public static function from(iterable $source, QueryContextInterface $context = null): static; |
This is precisely the use case static returns were added for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right, I updated it!
* | ||
* @return QueryContextInterface | ||
*/ | ||
public function getContext(): QueryContextInterface; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"context objects" are a code smell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can understand this. Maybe getContext
, context
arguments and QueryContextInterface
could simply be removed!
proposed/query.md
Outdated
* | ||
* @return QueryInterface | ||
*/ | ||
public function applyModifier(QueryModifierInterface $modifier): QueryInterface; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ibid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed as well. And also learnt what "ibid" stands for, thanks! 😄
115d1e6
to
9b34ac6
Compare
proposed/query.md
Outdated
*/ | ||
interface QueryInterface | ||
{ | ||
/**namespace Psr\Query; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This namespace looks like a cut&paste error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, definitely. Thank you!
9b34ac6
to
5cd59f1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks interesting to me...
A new PSR to standardize how data can be queried.
Here is the Google Groups thread: https://groups.google.com/g/php-fig/c/bKg4OvW-wcY