# |
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 |
# |
May 31st 2016, 09:59 |
birdy247 |
around here Type::build('datetime') |
# |
May 31st 2016, 09:59 |
birdy247 |
Neon1024 what does your bootstrap look like |
# |
May 31st 2016, 09:55 |
birdy247 |
I tried jose_zaps revission |
# |
May 31st 2016, 09:44 |
Neon1024 |
I donâ??t get any errors at least :p |
# |
May 31st 2016, 09:44 |
Neon1024 |
Unless it doesnâ??t |
# |
May 31st 2016, 09:44 |
Neon1024 |
Sorry, it works fine for me |
# |
May 31st 2016, 09:40 |
birdy247 |
so so difficult to achieve something that seems so so easy lol |
# |
May 31st 2016, 09:40 |
birdy247 |
face palm |
# |
May 31st 2016, 09:40 |
birdy247 |
Neon1024 the problem with that is it then doesnt return a datetime object when i do a find() |
# |
May 31st 2016, 09:33 |
unorthodox |
:) |
# |
May 31st 2016, 09:32 |
Neon1024 |
p |
# |
May 31st 2016, 09:32 |
Neon1024 |
https://github.com/davidyell/CakePHP3-Proffer/blob/master/src/Database/Type/FileType.php |
# |
May 31st 2016, 09:32 |
Neon1024 |
Check out my super complex data type class |
# |
May 31st 2016, 09:32 |
Neon1024 |
Just do that, but in a data type class |
# |
May 31st 2016, 09:29 |
birdy247 |
and stop cake doing any marshalling of datetime for me and I do it in the entity myself using createFromFormat |
# |
May 31st 2016, 09:28 |
birdy247 |
unless I make a "plain" data type |