开发者

Doctrine\ODM\MongoDB\Query\Builder serialization breaks mongo connection

开发者 https://www.devze.com 2023-03-13 04:38 出处:网络
I have an object that has an instance of Doctrine\\ODM\\MongoDB\\Query\\Builder . When I serialize my object, unserialize it, and then try to use the Builder, I get the following error:

I have an object that has an instance of Doctrine\ODM\MongoDB\Query\Builder . When I serialize my object, unserialize it, and then try to use the Builder, I get the following error:

Fatal error: Uncaught exception 'MongoException' with message 'The MongoCursor object has not been correctly initialized by its constructor'

I assume that this is because PHP 开发者_开发问答looses its connection to the mongo server in the serialization process. How can I fix this?


You can't. The only thing you can do is to remove that object on serialization and create a new one on unserialization. See the serializable interface in PHP.

0

精彩评论

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