I'm having the same issue. I discovered today that when I try to use cakephp as a webservice provider that returns json, it turns all the results into strings. It's all traced backed to the results returned by models being all strings.
To me this is a serious problem as you pointed out. It leaves me to coerce the data type either in the clients in ios or insert ugly coercion code before the data is serialized into json. I always thought cakephp would use inference to convert to the right data type when looking at the table structure. This doesn't appear to be working. The manual document the $_schema property that allows users to specifies the type, this also seemed to be ignored as well. On Monday, June 11, 2012 7:31:48 PM UTC-7, Brad Koch wrote: > > I'm currently facing an issue regarding the data types being read from the > database. Regardless of the type specified in the schema definition, all > data is read in as a string. It's a well documented issue. The encoding > of numbers as strings wrecks general havoc when it gets converted to JSON > and hits the client side code. > > My intended solution is to write a behavior that utilizes Model::_schema > to automatically sanitize the results. However, I don't want to go out and > reinvent the wheel if there's a solution out there I don't know about yet. > > Is anyone aware of a CakePHP framework feature / library that correctly > sanitizes the database input? > > -- > Brad Koch > > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
