added MongoStatement class, modified DbDriver hierarchy
This commit is contained in:
@ -65,9 +65,15 @@ class FindMongoCommand extends MongoDbCommand
|
||||
|
||||
protected $fields;
|
||||
|
||||
protected $multiple = true;
|
||||
|
||||
protected function concreteExecute()
|
||||
{
|
||||
return $this->collection->find($this->condition, $this->fields);
|
||||
if($this->multiple) {
|
||||
return $this->collection->find($this->condition, $this->fields);
|
||||
} else {
|
||||
return $this->collection->findOne($this->condition, $this->fields);
|
||||
}
|
||||
}
|
||||
|
||||
protected function checkParams()
|
||||
@ -84,7 +90,7 @@ class InsertMongoCommand extends MongoDbCommand
|
||||
{
|
||||
protected $data;
|
||||
|
||||
protected $safe;
|
||||
protected $safe = true;
|
||||
|
||||
protected function concreteExecute()
|
||||
{
|
||||
@ -107,13 +113,16 @@ class UpdateMongoCommand extends MongoDbCommand
|
||||
|
||||
protected $data;
|
||||
|
||||
protected $upsert;
|
||||
protected $multiple = true;
|
||||
|
||||
protected $safe;
|
||||
protected $upsert = false;
|
||||
|
||||
protected $safe = true;
|
||||
|
||||
protected function concreteExecute()
|
||||
{
|
||||
return $this->collection->update($this->condition, $this->data, array('upsert' => $this->upsert, 'safe' => $this->safe));
|
||||
return $this->collection->update($this->condition, $this->data,
|
||||
array('multiple' => $this->multiple, 'upsert' => $this->upsert, 'safe' => $this->safe));
|
||||
}
|
||||
|
||||
protected function checkParams()
|
||||
@ -132,7 +141,7 @@ class RemoveMongoCommand extends MongoDbCommand
|
||||
{
|
||||
protected $condition;
|
||||
|
||||
protected $safe;
|
||||
protected $safe = true;
|
||||
|
||||
protected function concreteExecute()
|
||||
{
|
||||
|
Reference in New Issue
Block a user