Welcome Guest, Not a member yet? Register   Sign In
How do I get Scheme Information with RESTful controller?
#1

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 ... ; )
Reply
#2

Add this, when finished remove it.

PHP Code:
// just before the return should show you what is returned.
echo $response;
exit(); 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

Thanks, good tip.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB