开发者

String length at the start of a MySQL text field when using HYDRATE_NONE?

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, i开发者_StackOverflowf 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜