# |
Jul 14th 2017, 18:48 |
cleptric |
No, the getters work the same as the old ones :slightly_smiling_face: The `getBody()` method is part of the `MessageInterface` so it just returns the stream object now. IIRC, you could just (string) typecast them to get the content |
# |
Jul 14th 2017, 18:43 |
siran |
@cleptric you mean `getBody()`? what does inmutable means here? |
# |
Jul 14th 2017, 18:33 |
cleptric |
@siran The new request/response methods handle your object in a immutable way |
# |
Jul 14th 2017, 18:26 |
sturm |
Wish I had that kind of information in Visual Studio Code. |
# |
Jul 14th 2017, 18:18 |
siran |
@mikesmoniker there is also a difference between _response->body() and ->getBody()... my editor was marking body() as deprecated, so I was using getBody() which doesn't work |
# |
Jul 14th 2017, 18:13 |
gonzela2006 |
@siran Thanks for your suggestion but I think error logging should be the same for all exceptions |
# |
Jul 14th 2017, 18:11 |
siran |
@gonzela2006 I also believe you can have your own error handler, there you should be able to configure loggin to whatever you want |
# |
Jul 14th 2017, 18:09 |
siran |
@gonzela2006 maybe you can use your webserver's logs? would that help? |
# |
Jul 14th 2017, 18:08 |
siran |
but body() does know where to look |
# |
Jul 14th 2017, 18:08 |
siran |
I guess debug isn't sincere in the content of the object |
# |
Jul 14th 2017, 18:08 |
siran |
@mikesmoniker THANK you!! |
# |
Jul 14th 2017, 18:07 |
siran |
ill call body and see... |
# |
Jul 14th 2017, 18:07 |
siran |
y never call body(), i just debug _response |
# |
Jul 14th 2017, 18:07 |
mikesmoniker |
Are you calling body() more than once? |
# |
Jul 14th 2017, 18:06 |
siran |
AND from the actual app in the browser I can see the JSON |
# |
Jul 14th 2017, 18:05 |
gonzela2006 |
Hello can any one help me with my question at http://discourse.cakephp.org/t/add-client-ip-into-error-log-from-some-exceptions/2716 as the last reply was from 26 days ago |
# |
Jul 14th 2017, 18:05 |
siran |
i can see the data debugged in the controller, but an empty body in _response |
# |
Jul 14th 2017, 18:05 |
siran |
yup |
# |
Jul 14th 2017, 18:04 |
mikesmoniker |
So when you run phpunit you see the data before it goes to the view? |
# |
Jul 14th 2017, 18:04 |
siran |
and i have a debug in the test as i just showed |
# |
Jul 14th 2017, 18:04 |
siran |
i have a debug on the controller, which shows the data that should be encoded as json and sent to the view |
# |
Jul 14th 2017, 18:03 |
siran |
but really only debugging `debug($this->_response->body());` |
# |
Jul 14th 2017, 18:03 |
mikesmoniker |
And if you put a debug() or something in your controller code to check the data going into the response you see that it looks good when you run your test on the CLI? |
# |
Jul 14th 2017, 18:01 |
siran |
https://book.cakephp.org/3.0/en/development/testing.html#testing-a-json-responding-controller |
# |
Jul 14th 2017, 18:01 |
siran |
im basically doing ``` |
# |
Jul 14th 2017, 18:00 |
mikesmoniker |
I don’t know why that wouldn’t work. |
# |
Jul 14th 2017, 17:59 |
siran |
@mikesmoniker i'm using the _serialize way to return the json, that maybe it, somehow? |
# |
Jul 14th 2017, 17:58 |
siran |
@mikesmoniker from the test it also return 200 OK, but an empty body |
# |
Jul 14th 2017, 17:57 |
siran |
@mikesmoniker the controller works: from the browser it renders correctly the real data... on the test I can debug() the fixture data |
# |
Jul 14th 2017, 17:55 |
siran |
@rogerpro not a clue |
# |
Jul 14th 2017, 17:50 |
rogerpro |
That’s on the view. The code on a Controller runs well. |
# |
Jul 14th 2017, 17:49 |
rogerpro |
Hi everyone! How is this possible? with `debug($moment instanceof Cake\I18n\FrozenTime);` I get `true` and with `debug($moment->format('G:i:s'));` just next line I get a “Call to a member function format() on null” Error :S |
# |
Jul 14th 2017, 17:46 |
siran |
the controller fetches correctly the data of the fixture... I can debug() it |
# |
Jul 14th 2017, 17:42 |
mikesmoniker |
Are you sure your controller code is actually running? Can you verify that it is and you aren’t getting a 200 (maybe erroneously) for some other reason? |
# |
Jul 14th 2017, 17:38 |
siran |
oh, i really hate to waste time in things like this... why would the browser show the JSON response and the test shows an empty response although its status is 200 ? |
# |
Jul 14th 2017, 17:28 |
ben |
And, yes, we're looking to override it at the config level. |
# |
Jul 14th 2017, 17:27 |
ben |
Yes, we found that, but [maybe obviously] don't want to override it with each command we issue. |
# |
Jul 14th 2017, 17:26 |
mikesmoniker |
Check out `bin/cake migrations help migrate` and the `--source` option. I’m not sure if it’s possible to override it at a config level. |
# |
Jul 14th 2017, 17:23 |
ben |
We've already overheated "the Google" searching for this, and thought you all would have a quick link to the answer, if not the answer itself. |
# |
Jul 14th 2017, 17:22 |
ben |
If we're using CakePHP's migrations and want to use a custom path for the location of migration class files, is this configurable? If so, where? |
# |
Jul 14th 2017, 17:12 |
siran |
im testing a controller action that returns a JSON, from the browser I get a JSON responde, but if I do debug($this->_response) then 'body' is empty although response's status is 200... am I doing something wrong here? |