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:
Sean Harvey 2009-01-14 02:20:07 +00:00 committed by Sam Minnee
parent 6555d08b11
commit 0cb9633bbf

View File

@ -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;