Auto creates select items based on either the current objects column names, the supplied object, or an array.
This is primarily used in conjunciton with joinAdd, to enable the renaming of columns into a fixed format when they are likely to have naming conflicts (like both tables have an 'id' column).
Sending no arguments to selectAs, will reset the current select (usually removing the default *), and build a select list based on the current objects column names.
object | array $column_or_object - a dataobject or array of column names
string $format - the format the columns will appear, using sprintf format, the %s is replaced with the column name so car_%s would result in the SQL 'car.name as car_name' being generated.
string $tableName - this is used either when use send an array as the first argument, or when you are joining a table 'as' another name,
Example 39-1. Using selectAs()
|