Error 500 Trying to get property of non Object

I have problem ,

always get Error 500 "Trying to get property of non Object" while i try to show Notrans_FPB in my Cgridview, can anyone help me ? whats wrong with my code ,

Thanks …

This is my Controller "DafTimbangBahan"

    	public function actionAdmin()


		$model=new DafTimbangBahan('search');

		$dafFpbs=new DafFpb;


		$model->unsetAttributes();  // clear any default values







My Model DaftimbangBahan

	public function relations()


		// NOTE: you may need to adjust the relation name and the related

		// class name for the relations automatically generated below.

		return array(

			'dafBpbs' => array(self::HAS_MANY, 'DafBpb', 'Notrans'),

			'dafFpbs' => array(self::HAS_MANY, 'DafFpb', 'Notrans'),

			'koSup' => array(self::BELONGS_TO, 'Supplier', 'KoSup'),

			'koCab' => array(self::BELONGS_TO, 'Cabang2', 'KoCab'),

			'bahans' => array(self::MANY_MANY, 'Bahan', 'det_timbang_bahan(Notrans, KoHan)'),

			'notransTimbangs' => array(self::HAS_MANY, 'NotransTimbang', 'Notrans'),



and This is my View File

        <?php $this->widget('zii.widgets.grid.CGridView', array(







        'header'=>'No. FPB',








I don’t think this is valid:


See if the error goes away when you remove that line.

If you need to be able to filter on that attribute, you’ll need to add an extra attribute into the DafTimbangBahan class (something like $search_dafFpbs_Notrans_FPB), include that in the ‘search’ rules entry, make sure you join the table in your search() method, then add an extra search condition for the field.


Also, this line:


will cause the error you saw if there is no associated dafFpbs record. You should guard that with this sort of pattern:

'value'=>'isset($data->dafFpbs) ? $data->dafFpbs->Notrans_FPB : ""',