Skip to main content
16 events
when toggle format what by license comment
Nov 5, 2019 at 17:14 comment added slepic @shorif2000 I have added example usage. You should not do the slicing outside the ArrayPagePRovider as in you edit in your answer... The arrayPageProvider is designed to do just that. But dont get too stuck with that specific implementation, i dont really see a real usage for it... it is just the simplest implementation i could think of and also you were talking about arrays... but in real world you want to avoid array implementations probably...
Nov 5, 2019 at 17:11 history edited slepic CC BY-SA 4.0
added example of usage
Nov 5, 2019 at 13:06 comment added shorif2000 my new question codereview.stackexchange.com/questions/231889/…
Nov 5, 2019 at 12:51 vote accept shorif2000
Nov 5, 2019 at 12:32 comment added shorif2000 i have updated my repo. but how can i add support for it to handle Collection
Nov 5, 2019 at 10:34 comment added shorif2000 can you give me example of how it will be used. I have added how i think it works?
Nov 4, 2019 at 18:39 history edited slepic CC BY-SA 4.0
added 4424 characters in body
Nov 4, 2019 at 18:33 comment added slepic @shorif2000 ok so i eventualy made an edit instead of new answer after all. so have a read.
Nov 4, 2019 at 18:32 history edited slepic CC BY-SA 4.0
added 4424 characters in body
Nov 4, 2019 at 18:12 comment added shorif2000 Thanks. I have updated my README on github what I am trying to achieve.
Nov 4, 2019 at 17:49 comment added slepic @shorif2000 I think this answer doesn't really aim at the core of your problem. I dont wanna completly redo this answer nor delete it and so I will try to post another answer with a broader example and point you to some bad practices you do.
Nov 4, 2019 at 17:18 comment added shorif2000 I have updated it slightly. what do you think now? I added some update above for db support
Nov 4, 2019 at 13:13 comment added slepic @shorif2000 diving deeper into your code, I am very confused. It is all twisted inside out in a weird way. Naming is bad. Like why PaginatorInterface is implemented by Pagination when there is also PaginationInterface. Then there is DefaultPaginator which implements neither of the two. Collection class that is actualy some weird kind of array with fakable attributes, which gets sliced at some point... PaginatorInterface should tell you number of items and pages, not you tell it what those things are... I think you should hardly rethink what you are actualy doing.
Nov 4, 2019 at 12:54 comment added slepic @shorif2000 well, that's the array implementation. that one serves the purpose when you have all items in memory and want to serve pages of it. If you want something else, you need different implementation. Dont check if they provided array or ArrayObject and then construct ArrayData object from it. Let them pass the ArrayData to you (which is kinda the analogue to my ArrayPageProvider, so better let them pass the PageProviderInterface which is the abstraction)... you seem to be quite unfamiliar with the concept of IoC, generaly the overdose of new operator is not good...
Nov 4, 2019 at 11:56 comment added shorif2000 wont $this->items = $item; consume memory in ArrayPageProvider ?. I added update with some code on how i am slicing array
Nov 4, 2019 at 9:55 history answered slepic CC BY-SA 4.0