mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
API CHANGE #3548 ajshort: Allow a column argument for Query::column()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@78557 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
44639ca404
commit
c803dd6350
@ -702,15 +702,20 @@ abstract class Query extends Object implements Iterator {
|
||||
private $queryHasBegun = false;
|
||||
|
||||
/**
|
||||
* Return an array containing all values in the leftmost column.
|
||||
* Return an array containing all the values from a specific column. If no column is set, then the first will be
|
||||
* returned
|
||||
*
|
||||
* @param string $column
|
||||
* @return array
|
||||
*/
|
||||
public function column() {
|
||||
$column = array();
|
||||
public function column($column = null) {
|
||||
$result = array();
|
||||
|
||||
foreach($this as $record) {
|
||||
$column[] = reset($record);
|
||||
$result[] = ($column) ? $record[$column] : reset($record);
|
||||
}
|
||||
return $column;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user