Commit e8027c71 authored by Jens Segers's avatar Jens Segers

Small tweaks

parent 3f1be668
...@@ -8,7 +8,7 @@ class Builder extends \Illuminate\Database\Query\Builder { ...@@ -8,7 +8,7 @@ class Builder extends \Illuminate\Database\Query\Builder {
/** /**
* The database collection * The database collection
* *
* @var string * @var MongoCollection
*/ */
public $collection; public $collection;
...@@ -247,8 +247,6 @@ class Builder extends \Illuminate\Database\Query\Builder { ...@@ -247,8 +247,6 @@ class Builder extends \Illuminate\Database\Query\Builder {
$this->wheres[] = compact('column', 'type', 'boolean', 'values'); $this->wheres[] = compact('column', 'type', 'boolean', 'values');
$this->bindings = array_merge($this->bindings, $values);
return $this; return $this;
} }
...@@ -366,8 +364,7 @@ class Builder extends \Illuminate\Database\Query\Builder { ...@@ -366,8 +364,7 @@ class Builder extends \Illuminate\Database\Query\Builder {
*/ */
public function delete($id = null) public function delete($id = null)
{ {
$query = $this->compileWheres(); $result = $this->collection->remove($this->compileWheres());
$result = $this->collection->remove($query);
if (1 == (int) $result['ok']) if (1 == (int) $result['ok'])
{ {
...@@ -405,6 +402,16 @@ class Builder extends \Illuminate\Database\Query\Builder { ...@@ -405,6 +402,16 @@ class Builder extends \Illuminate\Database\Query\Builder {
return (1 == (int) $result['ok']); return (1 == (int) $result['ok']);
} }
/**
* Get a new instance of the query builder.
*
* @return Builder
*/
public function newQuery()
{
return new Builder($this->connection);
}
/** /**
* Compile the where array * Compile the where array
* *
...@@ -414,6 +421,7 @@ class Builder extends \Illuminate\Database\Query\Builder { ...@@ -414,6 +421,7 @@ class Builder extends \Illuminate\Database\Query\Builder {
{ {
if (!$this->wheres) return array(); if (!$this->wheres) return array();
// The new list of compiled wheres
$wheres = array(); $wheres = array();
foreach ($this->wheres as $i=>&$where) foreach ($this->wheres as $i=>&$where)
...@@ -535,14 +543,4 @@ class Builder extends \Illuminate\Database\Query\Builder { ...@@ -535,14 +543,4 @@ class Builder extends \Illuminate\Database\Query\Builder {
); );
} }
/**
* Get a new instance of the query builder.
*
* @return Builder
*/
public function newQuery()
{
return new Builder($this->connection);
}
} }
\ No newline at end of file
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