queryColumn() from a criteria and a model instead of command?


I love the CDbCommand::queryColumn() method which allows you to run a query and get the first column of the results as an array.

However, sometimes I have a model and a criteria and I do something like:


If I want to obtain just an array with the values of a single field (e.g. an array of IDs), I have to scan the array to copy the field of each instance into the desired array (or I can use array_map which basically does the same).

Isn’t there anything similar to queryColumn() that can be used with a CDbCriteria and model instead of with a CDbCommand? (even if it requires modifying the criteria so that the desired column is the first one). Or an immediate way to get a CDbCommand from a criteria and model?



AFAIK, there’s no way to do it in 1.1 :(

Still waiting for 2.0…