# |
Mar 12th 2018, 15:52 |
raul338 |
in that case the pagination helper should keep the id |
# |
Mar 12th 2018, 15:51 |
raul338 |
I think learningcake is trying to make a pagination inside a view, like /stores/63?page=2 |
# |
Mar 12th 2018, 15:51 |
dorxy |
is the reason you're writing it to the session because it is not persisted between pagination? or because you wish to access it for other requests as well? |
# |
Mar 12th 2018, 15:51 |
neon1024 |
Then might I recommend using a url friend slug of the username? |
# |
Mar 12th 2018, 15:51 |
learningcake |
@neon, it is meant to be a public data. thank you |
# |
Mar 12th 2018, 15:50 |
dereuromark |
I recommend using query strings instead as we probably all do :slightly_smiling_face: |
# |
Mar 12th 2018, 15:50 |
neon1024 |
Well if you’re using incremental id’s and you are not checking the id, I could just change it to 64 and see another users data |
# |
Mar 12th 2018, 15:50 |
dereuromark |
using the session for pagination stuff is usually a huge anti pattern and usability killer |
# |
Mar 12th 2018, 15:50 |
dorxy |
I'm still wondering how/why exactly you're doing it this way |
# |
Mar 12th 2018, 15:50 |
learningcake |
@neon, the id is exposed to the url. Any security risk? |
# |
Mar 12th 2018, 15:50 |
dorxy |
perhaps you should put an if statement around your write function to determine if there even is an ID parameter? |
# |
Mar 12th 2018, 15:49 |
neon1024 |
You can change the pagination url in the helper options |
# |
Mar 12th 2018, 15:49 |
learningcake |
no, the id is not persisted between pagination requests. Don't know how to make it persistent since the url is meant to be a unique link http://localhost:8765/mystore/63 |
# |
Mar 12th 2018, 15:49 |
neon1024 |
I hope the user id isn’t exposed to the url |
# |
Mar 12th 2018, 15:48 |
dorxy |
if you execute `$this->request->session()->write('User.id',$this->request->getParam('id'));` again on the next page, and maybe the ID param is not present in the URI at that point? |
# |
Mar 12th 2018, 15:47 |
dorxy |
is the id parameter persisted between the pagination requests? |
# |
Mar 12th 2018, 15:46 |
learningcake |
'63' being the parameter |
# |
Mar 12th 2018, 15:46 |
learningcake |
http://localhost:8765/mystore/63 |
# |
Mar 12th 2018, 15:46 |
dorxy |
@learningcake it also depends where exectly you execute the write and read |
# |
Mar 12th 2018, 15:45 |
raul338 |
should be getQuery / getData ? |
# |
Mar 12th 2018, 15:45 |
learningcake |
I created a method that searches database base on id parameter |
# |
Mar 12th 2018, 15:43 |
raul338 |
why getParam('id') ? |
# |
Mar 12th 2018, 15:43 |
learningcake |
any idea why my session doesn't work? |
# |
Mar 12th 2018, 15:35 |
kitcat711 |
thx |
# |
Mar 12th 2018, 15:35 |
kitcat711 |
raul338: the error was the return inside the map |
# |
Mar 12th 2018, 15:33 |
learningcake |
when I move to the next page, debugs show false |
# |
Mar 12th 2018, 15:33 |
learningcake |
$this->request->session()->write('User.id',$this->request->getParam('id')); $id = $this->request->session()->read('User.id'); debug($id); |
# |
Mar 12th 2018, 15:32 |
learningcake |
is it possible for pagination to destroy session when I move to the next page? |
# |
Mar 12th 2018, 15:31 |
raul338 |
also the return inside the map |
# |
Mar 12th 2018, 15:31 |
raul338 |
you're missing hydrate(false) in the second example |
# |
Mar 12th 2018, 15:28 |
kitcat711 |
raul338: I think (see gist) |
# |
Mar 12th 2018, 15:27 |
kitcat711 |
easier with my gist |
# |
Mar 12th 2018, 15:27 |
kitcat711 |
https://gist.github.com/Kitcat711/b22fb783382e2bc9d22b9025d21f20ca |
# |
Mar 12th 2018, 15:24 |
raul338 |
are you returning the $query in the finder? |
# |
Mar 12th 2018, 15:23 |
kitcat711 |
no error, but no results too |
# |
Mar 12th 2018, 15:22 |
kitcat711 |
I spoke to quicly |
# |
Mar 12th 2018, 15:09 |
kitcat711 |
found my way out |
# |
Mar 12th 2018, 15:09 |
kitcat711 |
thx dorxy |
# |
Mar 12th 2018, 15:07 |
dorxy |
@kitcat711 https://book.cakephp.org/3.0/en/orm/retrieving-data-and-resultsets.html#custom-finder-methods |
# |
Mar 12th 2018, 15:05 |
kitcat711 |
I am on 3.5 |
# |
Mar 12th 2018, 14:59 |
raul338 |
I do not konw about cakephp2 |