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.
精彩评论