Adapting Auto Generated Models With Yii::app()->Db->Createcommand()

I’ve auto created some models from database tables. I like some of the admin output but would like to customize it so I can join another table and get data from that and display it, I can see in my error message that it’s getting data for the join, but returns the error Property “CDbCriteria.mob_num” is not defined. My query is using Yii::app()->db->createCommand() but I don’t know how to correctly display this in the auto generated views I already have. Can anyone help please?


public function search()


		// Warning: Please modify the following code to remove attributes that

		// should not be searched.


            $criteria =  Yii::app()->db->createCommand()


    ->from('home_charge u')

    ->join('ppw_allcomms p', 'u.mob_num=p.pod_phone_number')



// can I use this or do I need something else ??    


     return new CActiveDataProvider($this, array(





   old auto generate query 



		$criteria=new CDbCriteria;













A CDbCriteria is not a CDbCommand.

Have a look here for the proper way to handle your scenario.