Commit 9133ba46 authored by pi0's avatar pi0

Remove deprecated lists

parent 9616f091
...@@ -13,7 +13,7 @@ class Builder extends EloquentBuilder ...@@ -13,7 +13,7 @@ class Builder extends EloquentBuilder
* @var array * @var array
*/ */
protected $passthru = [ protected $passthru = [
'toSql', 'lists', 'insert', 'insertGetId', 'pluck', 'toSql', 'insert', 'insertGetId', 'pluck',
'count', 'min', 'max', 'avg', 'sum', 'exists', 'push', 'pull', 'count', 'min', 'max', 'avg', 'sum', 'exists', 'push', 'pull',
]; ];
...@@ -167,7 +167,9 @@ class Builder extends EloquentBuilder ...@@ -167,7 +167,9 @@ class Builder extends EloquentBuilder
$query = $hasQuery->getQuery(); $query = $hasQuery->getQuery();
// Get the number of related objects for each possible parent. // Get the number of related objects for each possible parent.
$relationCount = array_count_values($query->lists($relation->getHasCompareKey())); $relationCount = array_count_values(array_map(function ($id) {
return (string)$id; // Convert Back ObjectIds to Strings
}, $query->pluck($relation->getHasCompareKey())));
// Remove unwanted related objects based on the operator and count. // Remove unwanted related objects based on the operator and count.
$relationCount = array_filter($relationCount, function ($counted) use ($count, $operator) { $relationCount = array_filter($relationCount, function ($counted) use ($count, $operator) {
...@@ -219,17 +221,13 @@ class Builder extends EloquentBuilder ...@@ -219,17 +221,13 @@ class Builder extends EloquentBuilder
if ($results instanceof Cursor) { if ($results instanceof Cursor) {
$results = iterator_to_array($results, false); $results = iterator_to_array($results, false);
return $this->model->hydrate($results); return $this->model->hydrate($results);
} } // Convert Mongo BSONDocument to a single object.
// Convert Mongo BSONDocument to a single object.
elseif ($results instanceof BSONDocument) { elseif ($results instanceof BSONDocument) {
$results = $results->getArrayCopy(); $results = $results->getArrayCopy();
return $this->model->newFromBuilder((array) $results); return $this->model->newFromBuilder((array)$results);
} } // The result is a single object.
// The result is a single object.
elseif (is_array($results) and array_key_exists('_id', $results)) { elseif (is_array($results) and array_key_exists('_id', $results)) {
return $this->model->newFromBuilder((array) $results); return $this->model->newFromBuilder((array)$results);
} }
return $results; return $results;
......
...@@ -569,14 +569,7 @@ class Builder extends BaseBuilder ...@@ -569,14 +569,7 @@ class Builder extends BaseBuilder
{ {
$results = $this->get(is_null($key) ? [$column] : [$column, $key]); $results = $this->get(is_null($key) ? [$column] : [$column, $key]);
// If the columns are qualified with a table or have an alias, we cannot use return $results->pluck($column,$key);
// those directly in the "pluck" operations since the results from the DB
// are only keyed by the column itself. We'll strip the table out here.
return Arr::pluck(
$results,
$column,
$key
);
} }
/** /**
...@@ -624,6 +617,7 @@ class Builder extends BaseBuilder ...@@ -624,6 +617,7 @@ class Builder extends BaseBuilder
/** /**
* Get an array with the values of a given column. * Get an array with the values of a given column.
* *
* @deprecated
* @param string $column * @param string $column
* @param string $key * @param string $key
* @return array * @return array
...@@ -640,10 +634,10 @@ class Builder extends BaseBuilder ...@@ -640,10 +634,10 @@ class Builder extends BaseBuilder
return $item; return $item;
}); });
return $results->lists($column, $key)->all(); return $results->pluck($column, $key)->all();
} }
return parent::lists($column, $key); return parent::pluck($column, $key);
} }
/** /**
......
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