# |
Jul 5th 2017, 12:02 |
cleptric |
https://book.cakephp.org/3.0/en/views.html#creating-your-own-view-classes |
# |
Jul 5th 2017, 12:00 |
ldsign |
So there is no way in extending the core JsonVIew and not touching my other code? |
# |
Jul 5th 2017, 11:59 |
ldsign |
Thanks. So I am forced to give every method which uses JsonView a custom viewClass? |
# |
Jul 5th 2017, 11:57 |
cleptric |
@ldsign Using you own JsonView wich inherits from JsonView and load the Helper there |
# |
Jul 5th 2017, 11:55 |
cleptric |
Yeah, this rewinds the stream to the start? Advanced php :) |
# |
Jul 5th 2017, 11:55 |
neon1024 |
Ahh, yes! Thanks chaps. I have some error text now :slightly_smiling_face: |
# |
Jul 5th 2017, 11:54 |
neon1024 |
Worth a shot! Thanks Jorge :slightly_smiling_face: |
# |
Jul 5th 2017, 11:54 |
neon1024 |
Oh you can just cast it? |
# |
Jul 5th 2017, 11:54 |
steinkel |
(string)$response->getBody() |
# |
Jul 5th 2017, 11:53 |
cleptric |
Ok, both the request and reponse `getBody()` returns a stream |
# |
Jul 5th 2017, 11:52 |
neon1024 |
So I wanted to check if I was getting an error string back to tell me more about why I’m getting a 400 |
# |
Jul 5th 2017, 11:52 |
neon1024 |
I thought it might be this, https://ecosystem.atlassian.net/browse/ACJIRA-1015 |
# |
Jul 5th 2017, 11:52 |
neon1024 |
The response from `\Cake\Http\Client::post` |
# |
Jul 5th 2017, 11:51 |
cleptric |
Wait, request or response? |
# |
Jul 5th 2017, 11:51 |
neon1024 |
Hm, okay, thanks @cleptric I guess the response is actually empty then! |
# |
Jul 5th 2017, 11:50 |
cleptric |
@neon1024 yep |
# |
Jul 5th 2017, 11:50 |
ldsign |
Hi. Do you know, how to use a custom helper in a core-viewclass? E.g. use ExtendedHtmlHelper in JsonView? |
# |
Jul 5th 2017, 11:50 |
neon1024 |
`$response->getBody()->getContents()` ? |
# |
Jul 5th 2017, 11:49 |
neon1024 |
When I try and see the content of an api request which is giving me a 400, I get steam php memory. How do I see the body content? |
# |
Jul 5th 2017, 11:46 |
juststeveking |
I know x) having one of those days |
# |
Jul 5th 2017, 11:45 |
cleptric |
No problem at all :slightly_smiling_face: Casting objects is more PHP then CakePHP ^^ |
# |
Jul 5th 2017, 11:45 |
juststeveking |
I figured it out from other code in the model |
# |
Jul 5th 2017, 11:45 |
juststeveking |
Sorry guys, relatively new to cake |
# |
Jul 5th 2017, 11:44 |
neon1024 |
gg PHP |
# |
Jul 5th 2017, 11:44 |
neon1024 |
Ah yes, it seems you can! https://3v4l.org/9TjST |
# |
Jul 5th 2017, 11:43 |
neon1024 |
I wonder what would happen |
# |
Jul 5th 2017, 11:43 |
neon1024 |
Can you cast a class to array? |
# |
Jul 5th 2017, 11:43 |
cleptric |
`$this` should be the Table when you’re calling your mail stuff in afterSave |
# |
Jul 5th 2017, 11:41 |
juststeveking |
Can I cast $this to an array to pass through to my email? |
# |
Jul 5th 2017, 11:40 |
juststeveking |
:slightly_smiling_face: thanks dde |
# |
Jul 5th 2017, 11:40 |
juststeveking |
`->viewVars()` |
# |
Jul 5th 2017, 11:36 |
cleptric |
don‘t remember the exact name right now ,:) |
# |
Jul 5th 2017, 11:36 |
cleptric |
And also something for the view vars |
# |
Jul 5th 2017, 11:35 |
cleptric |
There is a setTemplate method |
# |
Jul 5th 2017, 11:35 |
juststeveking |
I know, I have added it, but wasn't sure how to send through a rendered template with variables |
# |
Jul 5th 2017, 11:35 |
cleptric |
The Email class is available everywhere |
# |
Jul 5th 2017, 11:35 |
juststeveking |
I am used to swiftmailer |
# |
Jul 5th 2017, 11:34 |
juststeveking |
So how do I best pass through an email view to the CakeEmail class? |
# |
Jul 5th 2017, 11:34 |
juststeveking |
Ah ok :slightly_smiling_face: |
# |
Jul 5th 2017, 11:34 |
cleptric |
Components are tied to the Controller layer |
# |
Jul 5th 2017, 11:33 |
juststeveking |
But the people who built the application made a communication component |