Commit c9ebbbdf authored by Jeremy Mikola's avatar Jeremy Mikola

PHPLIB-89: String getters for Database and Collection classes

parent 76d62e2e
......@@ -69,6 +69,16 @@ class Collection
list($this->dbname, $this->collname) = explode(".", $namespace, 2);
}
/**
* Return the collection namespace.
*
* @param string
*/
public function __toString()
{
return $this->ns;
}
/**
* Runs an aggregation framework pipeline
*
......@@ -629,7 +639,7 @@ class Collection
}
/**
* Returns the CollectionName this object operates on
* Return the collection name.
*
* @return string
*/
......@@ -677,7 +687,7 @@ class Collection
}
/**
* Returns the DatabaseName this object operates on
* Return the database name.
*
* @return string
*/
......@@ -931,6 +941,17 @@ class Collection
);
}
/**
* Return the collection namespace.
*
* @see http://docs.mongodb.org/manual/faq/developers/#faq-dev-namespace
* @return string
*/
public function getNamespace()
{
return $this->ns;
}
/**
* Retrieves all Write options with their default values.
*
......
......@@ -41,6 +41,16 @@ class Database
$this->readPreference = $readPreference;
}
/**
* Return the database name.
*
* @param string
*/
public function __toString()
{
return $this->databaseName;
}
/**
* Create a new collection explicitly.
*
......@@ -89,6 +99,16 @@ class Database
return $this->manager->executeCommand($this->databaseName, $command, $readPreference);
}
/**
* Returns the database name.
*
* @return string
*/
public function getDatabaseName()
{
return $this->databaseName;
}
/**
* Returns information for all collections in this database.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment