Log message #3884268

# At Username Text
# May 31st 2016, 10:36 spriz FML
# May 31st 2016, 10:35 Neon1024 That doesnâ??t sound right, perhaps the docs are not correct
# May 31st 2016, 10:35 Neon1024 So if you $event->subject[â??idâ??] = $SessionId it adds another where?
# May 31st 2016, 10:35 spriz Iâ??ll post you a gist of the SQL generated
# May 31st 2016, 10:35 spriz aye, but if I add that in that event, it adds two times WHERE :S
# May 31st 2016, 10:35 Neon1024 So instead itâ??s WHERE Users.id = $AuthedUserIdFromSession
# May 31st 2016, 10:34 Neon1024 Assuming you want WHERE Users.id = $id still
# May 31st 2016, 10:34 spriz Ah, but how would you change it since the ->where clause has already been put in there?
# May 31st 2016, 10:34 Neon1024 Iâ??d just change the subjects id
# May 31st 2016, 10:34 Neon1024 I wouldnâ??t replace the query
# May 31st 2016, 10:34 Neon1024 Subject is a hard one as itâ??s totally dependant on the event
# May 31st 2016, 10:34 spriz I honestly never thought of straight up replacing the query with my own, only to alter it
# May 31st 2016, 10:33 Neon1024 Or let me know thoughts here, https://github.com/FriendsOfCake/crud/issues/394
# May 31st 2016, 10:33 Neon1024 Perhaps there could be a docs improvement there
# May 31st 2016, 10:33 Neon1024 So I think, okay, I can obvious use those keys to change the values in the Crud Subject
# May 31st 2016, 10:33 Neon1024 â??The Crud Subject contains the following keys:â?
# May 31st 2016, 10:32 Neon1024 http://crud.readthedocs.io/en/latest/events.html#crud-beforefind
# May 31st 2016, 10:32 spriz where do you read that in the docs that I can overwrite the subject? O_o
# May 31st 2016, 10:32 Neon1024 Yeah, itâ??s an event, so just change whatâ??s in the event and pass it back
# May 31st 2016, 10:32 spriz clever
# May 31st 2016, 10:31 spriz ah, overwrite the ->subject()
# May 31st 2016, 10:31 Neon1024 As it says in the docs
# May 31st 2016, 10:31 Neon1024 I would overwrite the event subject myself
# May 31st 2016, 10:31 Neon1024 Assuming that $userid === $UsersTable->primaryKey
# May 31st 2016, 10:31 spriz if I add a where clause with the ([Users.id => $id]) it makes SQL equilavant to WHERE users.id = NULL and users.id = realId
# May 31st 2016, 10:30 Neon1024 Or something similar to that is what I would try first time
# May 31st 2016, 10:30 Neon1024 $this->Crud->on(â??beforeFindâ??, function (Event $event) use ($userid) { $event->subject[â??idâ??] = $userid; }
# May 31st 2016, 10:30 Neon1024 So yeah
# May 31st 2016, 10:30 Neon1024 http://crud.readthedocs.io/en/latest/events.html#crud-beforefind
# May 31st 2016, 10:29 Neon1024 Let me look at the docs for the events
# May 31st 2016, 10:29 spriz @neon1024: Would you know where to hook into crud to prevent that it uses the $id from the url / method argument
# May 31st 2016, 10:28 spriz unorthodox: Aye, thatâ??s what I do - but I was trying to use a user id from the Authed one, with the crud view action, but I canâ??t seem to not let it apply the $table => $primaryKey thingy
# May 31st 2016, 10:28 Neon1024 spriz, Iâ??d just update the route, and create a Users::view method, which just hooks the crud event, to pass in the id and then lets crud carry on
# May 31st 2016, 10:28 Neon1024 spriz, You mean like reading a user id from the session?
# May 31st 2016, 10:27 micalm Google supports CalDAV AFAIK, so lots of people. ;)
# May 31st 2016, 10:25 phpcoder someone is using google calendar from php ?
# May 31st 2016, 10:24 phpcoder guys
# May 31st 2016, 10:23 unorthodox Handle it through your `UsersController->view()` function?
# May 31st 2016, 10:21 spriz Whatâ??s the best way of making something like /users/view work without actually using a id in the URL? Iâ??m using CRUD atm, and Iâ??m thinking between making a custom action for it, or one could redirect to /users/view/$id
# May 31st 2016, 10:09 birdy247 this was after advise from @lorenzo
# May 31st 2016, 10:09 birdy247 @neon1024: I removed the ->useLocaleParser(); and my old way continued working