Code Monkey home page Code Monkey logo

Comments (12)

kocsismate avatar kocsismate commented on May 21, 2024

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.

gfemorris avatar gfemorris commented on May 21, 2024

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.

waghanza avatar waghanza commented on May 21, 2024

@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.

gfemorris avatar gfemorris commented on May 21, 2024

@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 avatar waghanza commented on May 21, 2024

@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.

gfemorris avatar gfemorris commented on May 21, 2024

@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.

waghanza avatar waghanza commented on May 21, 2024

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.

waghanza avatar waghanza commented on May 21, 2024

@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.

gfemorris avatar gfemorris commented on May 21, 2024

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.

kocsismate avatar kocsismate commented on May 21, 2024

@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.

gfemorris avatar gfemorris commented on May 21, 2024

@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.

kocsismate avatar kocsismate commented on May 21, 2024

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 Documents and ResourceTransformers 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.