# |
Mar 7th 2018, 14:22 |
sam_indi |
I am passing the correct data, but still getting unauthorized |
# |
Mar 7th 2018, 14:20 |
sam_indi |
{ "name": "Unauthorized", "message": "Unauthorized", "url": "\/assets.json" } |
# |
Mar 7th 2018, 14:20 |
sam_indi |
Warning (512): Invalid salt: 1 for blowfish Please visit http://www.php.net/crypt and read the appropriate section for building blowfish salts. [CORE/Cake/Utility/Security.php, line 290] |
# |
Mar 7th 2018, 14:20 |
sam_indi |
This is the error I am getting: |
# |
Mar 7th 2018, 14:20 |
sam_indi |
Hi everyone. I am getting an error while calling the rest api in cakephp 2 application. |
# |
Mar 7th 2018, 14:19 |
jkpatel291289 |
i dont know hoe to print, but if you want to debug you can see actual query in debug bar sql tab. |
# |
Mar 7th 2018, 13:54 |
santosh.madeti |
Hi , How can we print the original Sql query from Cake query builder? |
# |
Mar 7th 2018, 12:40 |
iqu |
answer to myself. Collections |
# |
Mar 7th 2018, 12:33 |
ooskar1233 |
hey, anyone into crud-json-api? I’m trying to create self-referenced relationship and got some trouble inserting records |
# |
Mar 7th 2018, 12:30 |
iqu |
hmm. whats the strategy. i can send data to belongsToMany like patchEntity '_ids' => [1, 2, 3, 4]. can i access those _ids somehow easily in controller? how do i convert object to array in controller? |
# |
Mar 7th 2018, 12:19 |
neon1024 |
If I have to have to the query string, I should at least be able to map or obfuscate my param names |
# |
Mar 7th 2018, 12:16 |
neon1024 |
@dereuromark You’re right, there is no way to remove the paging params from the url. This seems very silly to me! It’s automatically exposing my schema to the url! |
# |
Mar 7th 2018, 12:14 |
jkpatel291289 |
how to set default option for date control of form helper? I don't want to pass options on every form where i use date control. |
# |
Mar 7th 2018, 12:04 |
narendravaghela |
yup, thanks :slightly_smiling_face: |
# |
Mar 7th 2018, 11:59 |
voidesc |
@narendravaghela - you can use something like: https://freegeoip.net/ to get the geolocation for the ip. or you can get the browser time / offset via js and then process that via php. |
# |
Mar 7th 2018, 11:51 |
narendravaghela |
okay..., so what is the best way to determine that? |
# |
Mar 7th 2018, 11:48 |
neon1024 |
Not reliably |
# |
Mar 7th 2018, 11:46 |
narendravaghela |
Is there any way to detect user timezone from request object? |
# |
Mar 7th 2018, 11:46 |
marcusgoede |
keys don’t matter here for me |
# |
Mar 7th 2018, 11:45 |
marcusgoede |
yes, i know, i was just confused, it did change the order of the array, but not as i wanted |
# |
Mar 7th 2018, 11:45 |
neon1024 |
If you do not want to preserve the key ordering perhaps you need to use a callback and your own sort function |
# |
Mar 7th 2018, 11:45 |
neon1024 |
Sorting on the registrationDate would put them in order of the value, it will not order the keys |
# |
Mar 7th 2018, 11:43 |
marcusgoede |
yes, but the keys are not sorted as well. 0, 11, 18, 17, … if i use ksort the values are still not ordered |
# |
Mar 7th 2018, 11:43 |
neon1024 |
Not sure, sorry, seems like it should be working |
# |
Mar 7th 2018, 11:41 |
neon1024 |
Those are not keys, they are values. |
# |
Mar 7th 2018, 11:40 |
slackebot |
(int) 17 => [ ‘registrationDate’ => ‘2018-02-28’, ... ], (int) 16 => [ ‘registrationDate’ => ‘2018-02-28’, ... ], (int) 15 => [ ‘registrationDate’ => ‘2018-02-28’, ... ], the keys are not orders |
# |
Mar 7th 2018, 11:40 |
marcusgoede |
ok, i understand and i changed the code. but it’s still strange. $collection = new Collection($users[‘users’]); $collection = $collection->sortBy(‘registrationDate’); $users = $collection->toArray(); $users: [ (int) 0 => [ ‘registrationDate’ => ‘2018-02-28’, ... ], (int) 11 => [ ‘registrationDate’ => ‘2018-02-28’, ... ], (int) 18 => [ ‘registrationDate’ => |
# |
Mar 7th 2018, 11:39 |
neon1024 |
Currently I can only see rolling my own PaginatorHelper as a solution |
# |
Mar 7th 2018, 11:39 |
neon1024 |
I don’t recall having this issue before |
# |
Mar 7th 2018, 11:38 |
neon1024 |
It seems to not be possible from what i can see, as the request params are used regardless |
# |
Mar 7th 2018, 11:38 |
neon1024 |
Okay, I’m really struggling on how to find out how I can remove the pagination query params from my pagination links, and also how to prevent users changing the sorting field in the query params |
# |
Mar 7th 2018, 11:21 |
neon1024 |
I don’t think collections work by reference |
# |
Mar 7th 2018, 11:21 |
neon1024 |
Yeah, I agree with @richellyitalo you are not assigning the return of your function call |
# |
Mar 7th 2018, 11:11 |
richellyitalo |
`$collection = $collection->sortBy...` |
# |
Mar 7th 2018, 11:11 |
richellyitalo |
Are you try `$collection->sortBy('registrationDate');` or put `$collection`before sortBy ? |
# |
Mar 7th 2018, 11:02 |
marcusgoede |
hello, can anybody help me why my collection is not sorted? I have no idea, what I am doing wrong. $collection = collection($users[‘users’]); $collection->sortBy(function ($user) { return $user[‘registrationDate’]; }); $users[‘users’] = $collection->toArray(); |
# |
Mar 7th 2018, 10:42 |
richellyitalo |
Nice tip....I will setup only in routes api. |
# |
Mar 7th 2018, 10:42 |
neon1024 |
If you have a web service and http on the same application, be sure you don’t set all your requests to application/json! :P |
# |
Mar 7th 2018, 10:42 |
richellyitalo |
ok...thanks , very helpfull |
# |
Mar 7th 2018, 10:41 |
neon1024 |
Just check the url and then you can use something like `$request = $request->withHeader('Content-Type', 'application/json')` |
# |
Mar 7th 2018, 10:40 |
neon1024 |
Middleware sounds very complicated, but is actually very simple |