refactored MongoModel to hide fetch method, fixed PHPDoc errors

This commit is contained in:
Anton Grebnev
2012-10-19 20:15:26 +04:00
parent efb6c2d34c
commit 11a5968105
14 changed files with 436 additions and 187 deletions

View File

@ -38,6 +38,12 @@ class MongoDriver extends NoSqlDbDriver
return $this->query($command, $params)->affectedRows();
}
/**
* @param string $collection Mongo collection name to search in
* @param array $condition Search conditions
* @param array $fields Fields to return in result set
* @return MongoStatement
*/
public function find($collection, $condition = array(), $fields = array())
{
$command = MongoCommandBuilder::factory(MongoCommandBuilder::FIND, $this->getCollection($collection));
@ -49,17 +55,6 @@ class MongoDriver extends NoSqlDbDriver
return $this->query($command, $params);
}
public function get($collection, $condition, $fields = array())
{
$command = MongoCommandBuilder::factory(MongoCommandBuilder::FIND, $this->getCollection($collection));
$params = array(
'condition' => $condition,
'fields' => $fields,
'multiple' => false
);
return $this->query($command, $params);
}
public function findAndModify($collection, $query, $update, $sort = array(), $field = array(), $upsert = false, $new = false, $remove = false)
{
$command = MongoCommandBuilder::factory(MongoCommandBuilder::COMMAND, $this->getCollection($collection));
@ -123,10 +118,9 @@ class MongoDriver extends NoSqlDbDriver
}
/**
* @param mixed $request
* @return DbStatement
* @return MongoStatement
*/
public function prepare($request)
{