Comments (12)
Hi,
This is a cool idea! I'll try to implement it as soon as I will be free from work overload... :) But I welcome any PR if you have the possibility to do it.
from yin.
Hi,
yes i will try to do a PR if i have the time to do.. (we all have the same problems with work overload)
Thanks for your reply anyway..
from yin.
@gfemorris @kocsismate I do not know it this is to handle at yin
level.
As filtering is a way to extract data (not to display them) from any source (a database for example), it could be at a higher level (a bundle
for symfony
for example)
What do you think ?
from yin.
@waghanza i don't think your topic is related to this one. This issue is just about the pagination links not including the filtering and sorting parameters.
For sure filtering itself should be ideally done on database level for performance reasons.
from yin.
@waghanza
You talk about filter params, no ?
I think it would be really cool if the sorting and filter params would automatically be included in the links of the pagination.
from yin.
@waghanza
You can create pagination links through yin. For example in your yin document you want to have the pagination links, so you call:
Links::createWithoutBaseUri()->setPagination(...
Those links actually do not include filtering and sorting params automatically, so you have to add them yourself. This is what the topic is about.
from yin.
ah, ok clearer now 😛
for me it was not to be done automatically, but having a feature that can enable / disable it
what I can contribute to
from yin.
@gfemorris just to be sure, you mean using something like getting books where author's name is glen in my example https://github.com/waghanza/book-manager like with
/books?filter[author.name]=glen
from yin.
yes and if you use pagination you want to have the filters in the links:
"next": "books/?filter[author.name]=glen&page[limit]=10&page[offset]=10",
and not
"next": "books/?page[limit]=10&page[offset]=10",
if you call:
Links::createWithoutBaseUri()->setPagination("books", $domainObject);
it will include the pagination links but not the filter links. so you have to add them yourself like
Links::createWithoutBaseUri()->setPagination("books/?filter[author.name]=glen", $domainObject);
(for sure you need to add them in another way, it is just for demonstration)
And because the filter and sorting params are known by yin anyway it could add them automaticaly like it does with the pagination params.
from yin.
@gfemorris Ah, I tried to fix this issue months before, but I couldn't come up with a good solution which is easy enough... :/ Hopefully, I'll be able to revisit this in the near future... But now, I'm working on introducing support for JSON:API v1.1. :)
from yin.
@kocsismate Anyway it is not that important just an improvement. I will probably check this again in the near future, when i start working on jsonapi projects again and then maybe provide a pull request. And great to hear that you are working on v1.1 integration.
from yin.
Hey @gfemorris,
Finally I had the opportunity to think and work on this ticket as part of my efforts to support JSON:API 1.1 (in Yin 4.0). You can see my implementation with an example in my commit: 0fc64d4
Unline in Yin 3, the request will be directly available from the Document
s and ResourceTransformer
s In Yin 4.0 (along with some other things), so adding this feature to the new version is more natural. Also, the proper implementation required a breaking change, so I don't plan to port it to Yin 3. :S
I hope that you'll like the feature and its implementation.
from yin.
Related Issues (20)
- Error in createResourceIdInvalidException HOT 3
- Parsed body always contains an empty array when using Symfony requests HOT 4
- Missing data in response if using omitDataWhenNotIncluded HOT 7
- Passing the DomainObject to the validateRequest() method of the hydrator class HOT 10
- [PHP8] Method ReflectionParameter::getClass() is deprecated HOT 3
- Data Transformer array_merge problem HOT 2
- The package doesn't support psr/http-message v2 HOT 1
- Using same temp stream in multiple requests HOT 1
- Possible bug in OffsetBasedPagination HOT 6
- Exception code 0 HOT 2
- Hydrating same type (child, parent) related entity HOT 2
- Feature request: InfoDocument support HOT 1
- How to hydrate a POST request with multiple resources HOT 4
- Content-Type and Accept headers not really under domain validation HOT 7
- Using validateJsonBody() before getResource() makes request body empty HOT 3
- Problem with recursive relations HOT 1
- AbstractLinks::transform() generates invalid "prev" / "next" links HOT 3
- Incorrect encoding of (pagination) query parameters HOT 6
- Throw Exception if 'data' and 'errors' coexist in the request body HOT 3
- Add support for PSR-17 Http factory HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yin.