/** * Wrapper method for MongoCursor::slaveOkay(). * * @see \Doctrine\MongoDB\Cursor::slaveOkay() * @see http://php.net/manual/en/mongocursor.slaveokay.php * @param boolean $ok * @return self */ public function slaveOkay($ok = true) { $ok = (bool) $ok; $this->baseCursor->slaveOkay($ok); $this->unitOfWorkHints[Query::HINT_SLAVE_OKAY] = $ok; return $this; }
protected function prepareCursor(Cursor $cursor) { $cursor->limit($this->query['limit']); $cursor->skip($this->query['skip']); $cursor->sort($this->query['sort']); $cursor->immortal($this->query['immortal']); if (null !== $this->query['slaveOkay']) { $cursor->slaveOkay($this->query['slaveOkay']); } if ($this->query['snapshot']) { $cursor->snapshot(); } foreach ($this->query['hints'] as $keyPattern) { $cursor->hint($keyPattern); } if ($this->query['eagerCursor'] === true) { $cursor = new EagerCursor($cursor); } return $cursor; }
protected function prepareCursor(Cursor $cursor) { $cursor->limit($this->query['limit']); $cursor->skip($this->query['skip']); $cursor->sort($this->query['sort']); $cursor->immortal($this->query['immortal']); $cursor->slaveOkay($this->query['slaveOkay']); if ($this->query['snapshot']) { $cursor->snapshot(); } foreach ($this->query['hints'] as $keyPattern) { $cursor->hint($keyPattern); } }
/** @override */ public function slaveOkay($okay = true) { if ($okay) { $this->hints[Query::HINT_SLAVE_OKAY] = true; } else { unset($this->hints[Query::HINT_SLAVE_OKAY]); } parent::slaveOkay($okay); return $this; }