Why select() doesn't accept array

Notice: This thread is very old.
meridius
Member | 34
+
0
-

Is there a reason why select() doesn't accept an (associative) array as its parameter? Like this:

$db->table("some")->select(array(
	"custom_column_name" => "SOME_FUNCTION(some_column)",
	"another_custom_column_name" => "SOME_FUNCTION(another_column)",
	"simple_column",
));

Instead of this:

$db->table("some")->select("
	SOME_FUNCTION(some_column) AS `custom_column_name`,
	SOME_FUNCTION(another_column) AS `another_custom_column_name`,
	`simple_column`
");

This way the selection could be more easily readable, especially when you use constants for column names:

$db->table(MyTable::getTableName())->select(array(
	MyEntity::CUSTOM_COLUMN_NAME => "SOME_FUNCTION(" . MyTable::SOME_COLUMN . ")",
	MyEntity::ANOTHER_CUSTOM_COLUMN_NAME => "SOME_FUNCTION(" . MyTable::ANOTHER_COLUMN . ")",
	MyTable::SIMPLE_COLUMN,
));
$db->table(MyTable::getTableName())->select("
	SOME_FUNCTION(" . MyTable::SOME_COLUMN . ") AS `" . MyEntity::CUSTOM_COLUMN_NAME ."`,
	SOME_FUNCTION(" . MyTable::ANOTHER_COLUMN . ") AS `" . MyEntity::ANOTHER_CUSTOM_COLUMN_NAME . "`,
	" . MyTable::SIMPLE_COLUMN
);