Log message #4193903

# At Username Text
# Jul 18th 2019, 13:47 noel I'm a bit confused by friendsofcake/crud... the docs don't show how the RESTful urls would be structured for each type of call? Where is that information? I mean I notice that it generally conforms to the format set out here: https://book.cakephp.org/3.0/en/views/json-and-xml-views.html#enabling-data-views-in-your-application but for example with bulk delete I can't figure out what the corresponding REST url would be?
# Jul 18th 2019, 13:34 neon1024 Maybe I’ll have to reflect the property :grimacing:
# Jul 18th 2019, 13:28 spriz Thanks @ndm
# Jul 18th 2019, 13:28 spriz I see I've done that elsewhere as well
# Jul 18th 2019, 13:28 spriz Do'h! `new Stream` ofc...
# Jul 18th 2019, 13:17 ndm @spriz You either live with converting the stream to a string (eg via `stream_get_contents()`), or you wrap the stream in a `\Psr\Http\Message\StreamInterface` object (for example `new \Zend\Diactoros\Stream($fp)`), there's not really much else you can do.
# Jul 18th 2019, 13:15 spriz If you find something awesome, feel free to post a gist! :)
# Jul 18th 2019, 13:12 neon1024 Thanks for the insight though @spriz I’ll have a go with some ideas
# Jul 18th 2019, 13:12 neon1024 Yeah, that’s why I thought I’d just assert the Query instance
# Jul 18th 2019, 13:11 spriz which is quite well done anyway :)
# Jul 18th 2019, 13:11 spriz + I feel I end up testing the ORM itself
# Jul 18th 2019, 13:11 spriz maybe `(` was added or something like taht
# Jul 18th 2019, 13:11 spriz Nah, it just sucks that tests fail because some optimizations were pushed in the ORM or something like that
# Jul 18th 2019, 13:10 neon1024 @spriz Oh no, is it that much of a pain! :grimacing:
# Jul 18th 2019, 13:10 neon1024 I guess I could use the callback to make an array and assert that
# Jul 18th 2019, 13:10 spriz which suck
# Jul 18th 2019, 13:10 spriz No good answers from me, then. Besides checking raw SQL
# Jul 18th 2019, 13:10 neon1024 Sometimes it adds contain and where, sometimes just where, etc
# Jul 18th 2019, 13:10 spriz I found that troublesome previously
# Jul 18th 2019, 13:10 spriz Ah yes
# Jul 18th 2019, 13:09 neon1024 I have a behaviour which appends conditions to a query. I’d like to unit test it with various queries to ensure it’s doing what I expect
# Jul 18th 2019, 13:09 spriz the the correct things were actually applied with ->where() ?
# Jul 18th 2019, 13:09 spriz what do you want to test?
# Jul 18th 2019, 13:09 spriz I'd assert on the SQL if i wanted to be that specific
# Jul 18th 2019, 13:08 neon1024 I’m not sure how I would assert in a loop like that, I’d much prefer `$where->getConditions(): array` but it doesn’t seem to be in the API unless I’ve missed it
# Jul 18th 2019, 13:07 neon1024 `$where = $query->clause('where'); $where->iterateParts($callable);`
# Jul 18th 2019, 13:07 neon1024 I’d like to match a where, but I can’t get past
# Jul 18th 2019, 13:06 neon1024 Do you get parts of the query and assert that, or assert on the SQL?
# Jul 18th 2019, 13:06 neon1024 How do people assert on beforeFind?
# Jul 18th 2019, 13:04 spriz I want to avoid the `stream_get_contents()` in that gist
# Jul 18th 2019, 13:04 spriz @graziel thanks, but I think I did not explain it well enough - here is 10 lines that explain my troubles :slightly_smiling_face: https://gist.github.com/Spriz/8a3ce743f012e7ecd1714642e2256ca8
# Jul 18th 2019, 13:00 neon1024 ..and ensure you sanitise any input query params
# Jul 18th 2019, 12:59 neon1024 @noel If you want to sidestep the pre-flight OPTIONS request, proxy the api endpoint in your application and call that from Node
# Jul 18th 2019, 12:58 graziel `->getBody()->write($string);
# Jul 18th 2019, 12:58 neon1024 @noel https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
# Jul 18th 2019, 12:58 spriz I have data in a stream I got from `fopen()` :)
# Jul 18th 2019, 12:58 neon1024 @noel This is part of the AJAX specification to prevent cross-origin ajax requests
# Jul 18th 2019, 12:57 spriz Hi peeps! Is there an easy way to pass on all data in a php resource/stream to `$this->response->withBody()` (It expects a PSR StreamInterface) :thinking_face:
# Jul 18th 2019, 12:33 noel I should point out that the same request made via Postman works but it doesn't work via axios.
# Jul 18th 2019, 12:28 noel Hi. I'm working with the friendsofcake/CRUD plugin. I'm having a problem with DELETE messages, where it's hitting pre-flight check OPTIONS and failing. Not sure whether I need to configure CakePHP or axios to fix this, nor how?
# Jul 18th 2019, 12:22 acosonic @neon1024 suggestion to use sendgrid is good for mass mailing