# |
Jul 6th 2018, 09:11 |
josbeir |
@a.didier probably is but nothing to do with cake itself |
# |
Jul 6th 2018, 09:10 |
a.didier |
hello, is it possible to obfuscate a cake project ? |
# |
Jul 6th 2018, 09:10 |
josbeir |
probably something like that |
# |
Jul 6th 2018, 09:09 |
josbeir |
return $this->response->withStringBody($blob)>withType('pdf') |
# |
Jul 6th 2018, 09:09 |
josbeir |
:P |
# |
Jul 6th 2018, 09:09 |
josbeir |
or what lorenzo sez |
# |
Jul 6th 2018, 09:09 |
lorenzo |
that’s pretty much what you need to do |
# |
Jul 6th 2018, 09:09 |
josbeir |
just echt the blob and respond with pdf as ctype |
# |
Jul 6th 2018, 09:09 |
lorenzo |
the response class has methods to stream a file |
# |
Jul 6th 2018, 09:08 |
portilloster |
@josbeir what I basically need to do is, first save the PDF as a blob in the database. Then, once stored, I want to read the blob and display the pdf file in a iframe in the view. |
# |
Jul 6th 2018, 08:54 |
josbeir |
in your controller action this should work `return $this->response->withFile('file.pdf');` |
# |
Jul 6th 2018, 08:51 |
josbeir |
@portilloster you mean just serve an existing pdf, not a generated one? |
# |
Jul 6th 2018, 08:44 |
josbeir |
* @throws \Cake\Mailer\Exception\MissingActionException * @throws \BadMethodCallException |
# |
Jul 6th 2018, 08:44 |
josbeir |
i think checking the return value as the exceptions throw by Mailer::send() do not directly relate to success/failure it seems |
# |
Jul 6th 2018, 08:43 |
josbeir |
you main to check for success/failure? |
# |
Jul 6th 2018, 08:20 |
neon1024 |
What is a good technique for knowing if you’ve sent an email? Just check the array return from `send()` or wrap in `try() catch {}` ? |
# |
Jul 6th 2018, 07:46 |
portilloster |
https://github.com/FriendsOfCake/CakePdf |
# |
Jul 6th 2018, 07:46 |
portilloster |
I found this information from @dereuromark but I believe is to turn part of your html code in PDF |
# |
Jul 6th 2018, 07:44 |
portilloster |
Does anyone knows how can I save a PDF as a blob and render it in a view? |
# |
Jul 6th 2018, 07:44 |
portilloster |
Morning all!! |
# |
Jul 6th 2018, 07:40 |
neon1024 |
Morning all |
# |
Jul 6th 2018, 00:00 |
chris-andre |
With that approach I get id of checked "item", and can use those ids in a condition to update status. Or is it a better approach? |
# |
Jul 5th 2018, 23:59 |
chris-andre |
Is this the best approach to get id's from a form where checked rows shall be updated? `Hash::extract(Hash::extract($this->request->getData(), '{n}[id!=0]'), '{n}.id')` |
# |
Jul 5th 2018, 23:28 |
rightscoreanalysis |
it seems to continue with the rest of the method |
# |
Jul 5th 2018, 23:28 |
rightscoreanalysis |
will my controller return at this point |
# |
Jul 5th 2018, 23:28 |
rightscoreanalysis |
if($foo){ $this->set('_serialize', ['reply']); $this->set(compact('reply')); } |
# |
Jul 5th 2018, 23:28 |
rightscoreanalysis |
if i have json routing enabled and I do this: |
# |
Jul 5th 2018, 22:44 |
chris-andre |
Thinking how to update checked records with a status or delete them. |
# |
Jul 5th 2018, 22:43 |
chris-andre |
Hi. What do you think of this approach, see line 25 and 71: https://gist.github.com/chris-andre/69232e61c2f56ca8a9c62459467e1bf6 |
# |
Jul 5th 2018, 21:30 |
bravo-kernel |
Not saying it can't be done btw, I have often wondered how these folks do it. https://jsonapi-suite.github.io/jsonapi_suite/how-to-autodocument |
# |
Jul 5th 2018, 21:26 |
bravo-kernel |
Hope this is clear. If you have annotations to share I would appreciate it. :thumbsup: |
# |
Jul 5th 2018, 21:25 |
bravo-kernel |
This is not even mentioning the relationships that can exist which makes me wonder how you managed to solve that. |
# |
Jul 5th 2018, 21:22 |
bravo-kernel |
This is not JSON API and I would expect to see something similar to: ```json { "data": { "type": "cocktails", "id": "3", "attributes": { "name": "Mojito", "description": "Rum based", "created": "2015-04-11T09:52:01+00:00", "modified": null } ``` |
# |
Jul 5th 2018, 21:21 |
bravo-kernel |
File uploaded https://cakesf.slack.com/files/U157AT2ET/FBKFGT2E8/image.png / https://slack-files.com/T053DPNCM-FBKFGT2E8-983e12af4b |
# |
Jul 5th 2018, 21:20 |
bravo-kernel |
What does not work (for me) and what I was trying to point out is the `Example Value` which basically should display how the API should respond (circled in red below) |
# |
Jul 5th 2018, 21:18 |
bravo-kernel |
- the `Try it out!` button send the JSON API header and thus the response from crud-json-api is returned in JSON API (which makes total sense) |
# |
Jul 5th 2018, 21:18 |
bravo-kernel |
Results: |
# |
Jul 5th 2018, 21:18 |
bravo-kernel |
- opened the ui |
# |
Jul 5th 2018, 21:17 |
bravo-kernel |
- changed both `consumes` and `produces` to `application/vnd.api+json` (which makes it available in the dropdown selector) |
# |
Jul 5th 2018, 21:17 |
bravo-kernel |
- copied the sample annotations from the cakephp-swagger readme to one of my controllers |
# |
Jul 5th 2018, 21:10 |
bravo-kernel |
@james.phillips I added cakephp-swagger just to make sure I understand correctly. |