int columns are pulled as string from DB in CakePHP

Viewed 1541

I'm fairly new to CakePHP, but I find it very easy to use so far. today I've encoutered a problem with data exporting from the db.

I'm exporting 1 of my models as JSON. Everything goes pretty well, except that I noticed that CakePHP exports the id column as string. The model is defined as int in mysql. I've checked both at the JSON output and in the model, by -

var_dump($this->Post->findById($id));exit;

and in the model too, the id is defined as a string.

This messes with other systems that rely on that JSON output, which are used to get an integer as ID.

I tried setting the $_schema attribute in the model, but this didn't change anything.

I would appreciate your help.

Thanks, Dan

1 Answers
Related