Permalink
Browse files

Merge pull request #92 from doctrine/read-pref-methods

CollectionTest refactoring and get/setReadPreference() methods
  • Loading branch information...
2 parents ec10f4d + 257fb45 commit bc59129ef94e548a9b7876357d86ccef962694b0 @jmikola jmikola committed Mar 4, 2013
@@ -666,6 +666,20 @@ public function getSlaveOkay()
return \MongoClient::RP_PRIMARY !== $readPref['type'];
}
+ public function getReadPreference()
+ {
+ return $this->getMongoCollection()->getReadPreference();
+ }
+
+ public function setReadPreference($readPreference, array $tags = null)
+ {
+ if (isset($tags)) {
+ return $this->getMongoCollection()->setReadPreference($readPreference, $tags);
+ }
+
+ return $this->getMongoCollection()->setReadPreference($readPreference);
+ }
+
public function validate($scanData = false)
{
return $this->getMongoCollection()->validate($scanData);
@@ -258,6 +258,20 @@ public function selectDatabase($name)
return $database;
}
+ public function getReadPreference()
+ {
+ return $this->mongo->getReadPreference();
+ }
+
+ public function setReadPreference($readPreference, array $tags = null)
+ {
+ if (isset($tags)) {
+ return $this->mongo->setReadPreference($readPreference, $tags);
+ }
+
+ return $this->mongo->setReadPreference($readPreference);
+ }
+
/**
* Method which creates a Doctrine\MongoDB\Database instance.
*
@@ -387,6 +387,20 @@ public function getSingleResult()
return $result;
}
+ public function getReadPreference()
+ {
+ return $this->getMongoDB()->getReadPreference();
+ }
+
+ public function setReadPreference($readPreference, array $tags = null)
+ {
+ if (isset($tags)) {
+ return $this->mongoCursor->setReadPreference($readPreference, $tags);
+ }
+
+ return $this->mongoCursor->setReadPreference($readPreference);
+ }
+
protected function retry(\Closure $retry, $recreate = false)
{
if ($this->numRetries) {
@@ -250,6 +250,20 @@ public function getSlaveOkay()
return \MongoClient::RP_PRIMARY !== $readPref['type'];
}
+ public function getReadPreference()
+ {
+ return $this->getMongoDB()->getReadPreference();
+ }
+
+ public function setReadPreference($readPreference, array $tags = null)
+ {
+ if (isset($tags)) {
+ return $this->getMongoDB()->setReadPreference($readPreference, $tags);
+ }
+
+ return $this->getMongoDB()->setReadPreference($readPreference);
+ }
+
public function getProfilingLevel()
{
return $this->getMongoDB()->getProfilingLevel();
Oops, something went wrong.

0 comments on commit bc59129

Please sign in to comment.