Mongolid\Cursor\Cursor::serialize PHP Method

serialize() public method

Serializes this object storing the collection name instead of the actual MongoDb\Collection (which is unserializable).
public serialize ( ) : string
return string Serialized object.
    public function serialize()
    {
        $properties = get_object_vars($this);
        $properties['collection'] = $this->collection->getCollectionName();
        return serialize($properties);
    }

Usage Example

 /**
  * Serializes this object. Drops the unserializable DriverCursor. In order
  * to make the CacheableCursor object serializable.
  *
  * @return string Serialized object.
  */
 public function serialize()
 {
     $this->documents = $this->cursor = null;
     return parent::serialize();
 }