Query return empty CSP object when wrapped? |
10-13-2021, 12:38 AM
(This post was last modified: 10-13-2021, 01:05 AM by blaasvaer. Edit Reason: Fucked up editor! )
If I do this in my controller:
PHP Code: return $this->response->setJSON($this->model->find($id)); I properly get the data I want as an object: Code: { But if I wrap it like this: PHP Code: $response = array(); I get this: Code: { Why the empty CSP object all of a sudden? I tried enabling CSP in the Config/App.php but that didn't change a thing ... and to be honest I don't like the 'random' character this has to it. NOTE: And by the way; this editor has serious problems when formatting and previewing posts ... al content gets scrambled and tons of new lines get added. It's basically a nightmare to use. I usually have to use a text editor and copy/paste and reformat everything everytime I make an edit to a post. Someone gonna fix this at some point? Weeeeeeell, that made perfectly sense. I should remove the 'response' part when adding it to an array ... sigh! Change this: PHP Code: $response["data"] = $this->response->setJSON($this->model->find($id)); To this: PHP Code: $response["data"] = $this->model->find($id);
(10-13-2021, 12:38 AM)blaasvaer Wrote: NOTE: And by the way; this editor has serious problems when formatting and previewing posts ... al content gets scrambled and tons of new lines get added. It's basically a nightmare to use. I usually have to use a text editor and copy/paste and reformat everything everytime I make an edit to a post. Someone gonna fix this at some point? Yeah the editor is not very good. That's why I almost always type in "source code" mode. Click the last icon in the toolbar, or hit ctrl-shift-s to switch between the 2 modes (visual vs. source code)
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/ |
Welcome Guest, Not a member yet? Register Sign In |