views:

16

answers:

1

Hi,

I'm using Symfony 1.4 with Doctrine.

I'm saving text as MySQL text type (Doctrine "array" type) into the database, and it goes in clean & correct.

When querying the data back, if I use Doctrine_Core::HYDRATE_ARRAY the data is returned as it should be. However, if I use HYDRATE_NONE, the data is returned with the text length appended to it:

S:45"this is some text from the database"  // where "45" is the length.

Is this expected behaviour or might I have defined the wrong type?

Thanks.

+1  A: 

The text you are seeing is the serialized form of the array. If you choose not to hydrate, you will get the serialized form, as Doctrine converts the array into a serialized form in order to store it in a TEXT column in MySQL. PHP's serialize/unserialize function pairs should provide an example of the type of process used by Doctrine.

Raise