# |
Jul 15th 2017, 04:57 |
aro |
is there a way to prevent jsonview |
# |
Jul 15th 2017, 04:54 |
savant |
iirc all we do is json_encode at the end of the day in JsonView |
# |
Jul 15th 2017, 04:54 |
savant |
weird |
# |
Jul 15th 2017, 04:44 |
aro |
see how it preserves the order? thats after running it thru json encode |
# |
Jul 15th 2017, 04:44 |
aro |
damn it slack |
# |
Jul 15th 2017, 04:44 |
aro |
shoot |
# |
Jul 15th 2017, 04:44 |
slackebot |
"Reactive Broadband Support Services", "11430115": "SCG 3G\/4G Failover Services - Wired Ethernet Option with 100MB", "14980322": "Secure Cloud Gateway (SCG)", "16200160": "SecureCompliance", "5357180": "SecureCompliance Premium", "11042214": "SecureHIPAA", "4999387": "SecurePCI", "8233419": "SecurePCI Enhanced", "12399691": "SecurePCI Premium" } }``` |
# |
Jul 15th 2017, 04:44 |
aro |
```{ "products": { "8604451": "Cisco Meraki MX64w", "11929191": "Guest WiFi with WAP", "16289495": "Managed Security", "8265018": "PCI Compliance, WiFi \u0026 Firewall Services", "16598517": "PCI Portal", "8599719": "PCI Protect - Bronze", "8540716": "PCI Protect - Gold", "1975928": "PCI Protect - Silver", "2571398": "Professional On-Site Installation (Per Location)", |
# |
Jul 15th 2017, 04:43 |
aro |
irregardless of the integers |
# |
Jul 15th 2017, 04:43 |
aro |
and savant: with regards to json encode, it DOES preserve the order of the array |
# |
Jul 15th 2017, 04:42 |
aro |
try_files $uri $uri/ /index.php?$args; |
# |
Jul 15th 2017, 04:42 |
aro |
i have it set up per the book config |
# |
Jul 15th 2017, 04:42 |
savant |
i would check your nginx config to see if its handling more than just existing files when not sending to php |
# |
Jul 15th 2017, 04:41 |
aro |
hang on |
# |
Jul 15th 2017, 04:41 |
aro |
let me test that |
# |
Jul 15th 2017, 04:41 |
savant |
so I think when it json encodes, it decides it sees integers and reorders |
# |
Jul 15th 2017, 04:41 |
aro |
i know that |
# |
Jul 15th 2017, 04:41 |
savant |
php doesnt have any concept of ordered arrays if the keys are all integers |
# |
Jul 15th 2017, 04:41 |
aro |
so i figured id try doing a data view using the template, so i added .json to my request url, and now i get 404 errors |
# |
Jul 15th 2017, 04:40 |
aro |
instead of the way it appears in the php array |
# |
Jul 15th 2017, 04:40 |
aro |
like ordered by key |
# |
Jul 15th 2017, 04:40 |
aro |
it shows up in my json view as reordered |
# |
Jul 15th 2017, 04:39 |
aro |
but when i do $this->set(compact('products')); $this->set('_serialized', ['products']); |
# |
Jul 15th 2017, 04:39 |
aro |
which works great |
# |
Jul 15th 2017, 04:39 |
aro |
well, i do a $this->Products->find('list')->order([my => 'asc'])->toArray(); |
# |
Jul 15th 2017, 04:38 |
savant |
what do you mean by serialized list |
# |
Jul 15th 2017, 04:38 |
savant |
you’re probably not sending all requests to php-fpm or php-fastcgi |
# |
Jul 15th 2017, 04:38 |
aro |
do we need any specific config for nginx to make that work? |
# |
Jul 15th 2017, 04:38 |
aro |
also when i send ajax requests to cake with the extension .json, i get 404 errors from nginx |
# |
Jul 15th 2017, 04:17 |
aro |
it keeps ordering them by key |
# |
Jul 15th 2017, 04:17 |
aro |
is there a way to get a serialized list from a find to be in order by value? |
# |
Jul 15th 2017, 03:46 |
admad |
@jagspecx checkout muffin/webservice plugin |
# |
Jul 15th 2017, 01:00 |
savant |
https://book.cakephp.org/3.0/en/core-libraries/httpclient.html |
# |
Jul 15th 2017, 01:00 |
savant |
are you using the http client? |
# |
Jul 15th 2017, 00:54 |
jagspecx |
Ok, I’ve been working on this all day and feel no closer than when I started - I’m trying to consume an external API/webservice in CakePHP 3 but I can’t find a clear example on which I can base my implementation. Can someone please point me to a good sample implementation? Or something in the Book I might have overlooked? I have to believe that I’m not the first person to need something like this. Thanks in advance! |
# |
Jul 15th 2017, 00:04 |
ben |
:beers: |
# |
Jul 14th 2017, 23:34 |
savant |
whatever works, ship it |
# |
Jul 14th 2017, 23:34 |
savant |
but again, your business, your rules :slightly_smiling_face: |
# |
Jul 14th 2017, 23:34 |
savant |
that seems to actually be the opposite of beneficial as it is introducing an extra layer of indirection and more work for the business |
# |
Jul 14th 2017, 23:33 |
savant |
but I dont know what business/operational benefit there would be to using a new path for something that works fine as is, especially if replacing an existing system |
# |
Jul 14th 2017, 23:33 |
savant |
I dont really feel like arguing the point, especially as you’re going to make the change as you see fit |