Array od primary keys

I have a question, is there any built-in method that help me to get array of primary keys from model array?

I know that i can use simple loop, but if yii has such method i will rather use it.

sorry for 2 post deleted before this. i dont read your question in detail.

a) look at CActiveRecord.html / primaryKey, it returns the primary key for your model.


B) Create a method for your model, that returns the named attributes: return array(“idcustomer”,“iddepartment”)

You could use index of CDbCriteria.

$models = Post::model()->findAll(array('index' => 'id'));

$primaryKeys = array_keys($models);