Example #1
0
 /**
  * Recreates the internal RiakCursor.
  */
 public function recreate()
 {
     $this->riakCursor = $this->collection->getRiakCollection()->find($this->query, $this->fields);
     if ($this->hint !== null) {
         $this->riakCursor->hint($this->hint);
     }
     if ($this->immortal !== null) {
         $this->riakCursor->immortal($this->immortal);
     }
     foreach ($this->options as $key => $value) {
         $this->riakCursor->addOption($key, $value);
     }
     if ($this->batchSize !== null) {
         $this->riakCursor->batchSize($this->batchSize);
     }
     if ($this->limit !== null) {
         $this->riakCursor->limit($this->limit);
     }
     if ($this->skip !== null) {
         $this->riakCursor->skip($this->skip);
     }
     if ($this->slaveOkay !== null) {
         $this->setRiakCursorSlaveOkay($this->slaveOkay);
     }
     // Set read preferences after slaveOkay, since they may be more specific
     if ($this->readPreference !== null) {
         if ($this->readPreferenceTags !== null) {
             $this->riakCursor->setReadPreference($this->readPreference, $this->readPreferenceTags);
         } else {
             $this->riakCursor->setReadPreference($this->readPreference);
         }
     }
     if ($this->snapshot) {
         $this->riakCursor->snapshot();
     }
     if ($this->sort !== null) {
         $this->riakCursor->sort($this->sort);
     }
     if ($this->tailable !== null) {
         $this->riakCursor->tailable($this->tailable);
     }
     if ($this->timeout !== null) {
         $this->riakCursor->timeout($this->timeout);
     }
 }