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?

code


public function search()

	{

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

		// should not be searched.

          

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

                      ->select('mob_num,sim_num,pod_phone_number')

    ->from('home_charge u')

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

      ->queryRow();

     

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

     		

     return new CActiveDataProvider($this, array(

		'criteria'=>$criteria,

		));

	

		

   old auto generate query 

            /*

       

		$criteria=new CDbCriteria;


		$criteria->compare('id',$this->id,true);

		$criteria->compare('sim_num',$this->sim_num,true);

		$criteria->compare('mob_num',$this->mob_num,true);

		$criteria->compare('Scheme',$this->Scheme,true);

		$criteria->compare('PPN_ID',$this->PPN_ID,true);

		

		$criteria->compare('ActivationDate',$this->ActivationDate,true);


		

	

                */

                

        }

A CDbCriteria is not a CDbCommand.

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