CodeIgniter Forums
How do I get Scheme Information with RESTful controller? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: How do I get Scheme Information with RESTful controller? (/showthread.php?tid=78150)



How do I get Scheme Information with RESTful controller? - blaasvaer - 12-06-2020

Hi,



I'm trying to get Schema Information with every request from a RESTful controller ...



I have absolutely no clue HOW to debug by using var_dump from the model, as it will simply fail if I do not provide all the bells and whistles for it to function the ways it's supposed to ... now HOW would I 'break' (basically STOP) the Model from expecting to get everything it provides, and simply enable me to simply return a var_dump for getting a better understanding of WHAT's going on internally.




I find myself completely crippled when trying to get an understanding (oh no, don't ask me to read the docs ... I've DONE that at least 50 times by now). But when I need to 'inspect' anything in codeigniter I find it extremely difficult to 'intercept' ANYTHING in the way I like to ... by simply outputting stuff for me to inspect.




Instead of doing this ($id comes from a config object):





Code:
$response->data = $this->setResponseFormat('json')->respond($this->model->find($id), 200);



I'm trying to do this ($resource comes from a config object):




Code:
$fields = $db->getFieldsNames($resource->table);

    $response->fields = $fields;

    $response->data = $this->setResponseFormat('json')->respond($this->model->find($id), 200);

    return $response;



But my main question is basically: HOW do I debug or 'inspect' what a Model is actually returning?




I seem to have to in first go provide the RIGHT information, in all other cases I'll get kicked in the balls.





Please, enlighten me on what I'm missing on how to control CI instead of it controlling me ... ; )


RE: How do I get Scheme Information with RESTful controller? - InsiteFX - 12-06-2020

Add this, when finished remove it.

PHP Code:
// just before the return should show you what is returned.
echo $response;
exit(); 



RE: How do I get Scheme Information with RESTful controller? - blaasvaer - 12-06-2020

Thanks, good tip.