I'm using an older version of Symonfy, 1.3.0-BETA1. Not **TOO** old.

But I've got weird problem. If I use:

$object = Doctrine::getTable('Listing')->find($id);
$output = json_encode( $object->toArray() );

all my values will be strings in the JSON. So I did the following:

$object = Doctrine::getTable('Listing')->find($id);
var_dump( $object );

And guess what? The model object stores everything as a string, just
the way it got it from the database. OK, that's a good idea(TM), cause
it saves running casts unnecessarily if the output is just going to
the web, or to PHP code that will change the type according to the
context. (In my experience, all interfaces, database, http, etc., use
strings these days, nothing is binary except images.)

If it makes any difference, I built the schema from the database, not
the other way around, and the values of interest are shown as integer
(eight) .

But the method 'toArray()', should return exactly what was put in the
bind statement, types and all. It should be the 'goes-out' mirror of
the 'goes-in' to the database, (I think anyway)

Anyway, anyone else have this problem in the 1.3/1.4 releases? I would
upgrade if that is fixed, (obvioulsy I will have to eventually.)

Has 'toArray() always returned a string value for each field no matter
the type, and to get the type right we've always had to cast them?

--

You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.


Reply via email to