mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Fix potential undefined variable errors in Query->column() and Query->keyedColumn() by always returning an array, even if it's empty. This now conforms to the phpDoc for these two functions, instead of returning null if there's no $column variable set
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@70133 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
6555d08b11
commit
0cb9633bbf
@ -522,10 +522,11 @@ abstract class Query extends Object implements Iterator {
|
||||
* @return array
|
||||
*/
|
||||
public function column() {
|
||||
$column = array();
|
||||
foreach($this as $record) {
|
||||
$column[] = reset($record);
|
||||
}
|
||||
return isset($column) ? $column : null;
|
||||
return $column;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -534,6 +535,7 @@ abstract class Query extends Object implements Iterator {
|
||||
* @return array
|
||||
*/
|
||||
public function keyedColumn() {
|
||||
$column = array();
|
||||
foreach($this as $record) {
|
||||
$val = reset($record);
|
||||
$column[$val] = $val;
|
||||
|
Loading…
x
Reference in New Issue
Block a user