Commit 0e62cdb3 authored by pi0's avatar pi0

Reformat and FIX

parent ab5b3844
......@@ -226,12 +226,12 @@ class Builder extends EloquentBuilder
// Convert Mongo BSONDocument to a single object.
elseif ($results instanceof BSONDocument) {
$results = $results->getArrayCopy();
return $this->model->newFromBuilder((array)$results);
return $this->model->newFromBuilder((array) $results);
}
// The result is a single object.
elseif (is_array($results) and array_key_exists('_id', $results)) {
return $this->model->newFromBuilder((array)$results);
return $this->model->newFromBuilder((array) $results);
}
return $results;
......
......@@ -267,7 +267,7 @@ class Builder extends BaseBuilder
$results = iterator_to_array($this->collection->aggregate($pipeline, $options));
// Return results
return SHOULD_RETURN_COLLECTION ? new Collection($results) : $results;
return $this->use_collection ? new Collection($results) : $results;
}
// Distinct query
......@@ -282,7 +282,7 @@ class Builder extends BaseBuilder
$result = $this->collection->distinct($column);
}
return SHOULD_RETURN_COLLECTION ? new Collection($result) : $result;
return $this->use_collection ? new Collection($result) : $result;
}
// Normal query
......@@ -326,7 +326,7 @@ class Builder extends BaseBuilder
// Return results as an array with numeric keys
$results = iterator_to_array($cursor, false);
return SHOULD_RETURN_COLLECTION ? new Collection($results) : $results;
return $this->use_collection ? new Collection($results) : $results;
}
}
......@@ -1038,4 +1038,4 @@ class Builder extends BaseBuilder
return parent::__call($method, $parameters);
}
}
\ 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