Log message #3884281

# At Username Text
# May 31st 2016, 10:40 Neon1024 I was suggesting you guys make a north Denmark usergroup :)
# May 31st 2016, 10:39 Neon1024 I think they got in touch with you
# May 31st 2016, 10:39 spriz Woot! Who was that? Unfortunately I wasnâ??t there :(
# May 31st 2016, 10:39 Neon1024 bump*
# May 31st 2016, 10:39 Neon1024 Missed you at Cakefest! Although I did dump into some other guys from north Denmark
# May 31st 2016, 10:38 spriz Thanks a lot! Cheers! Have one of those great ciders for me! :P
# May 31st 2016, 10:38 Neon1024 )
# May 31st 2016, 10:38 spriz https://gist.github.com/Spriz/e30343f1b487bc9340c96bcae3b03f98#file-gistfile1-txt-L8 that is.
# May 31st 2016, 10:38 spriz I did this: https://gist.github.com/Spriz/e30343f1b487bc9340c96bcae3b03f98
# May 31st 2016, 10:37 Neon1024 D
# May 31st 2016, 10:36 spriz You answered the question on the first attamp
# May 31st 2016, 10:36 spriz Sorry about that
# May 31st 2016, 10:36 spriz disregard that
# 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