sory another yii question, try this bust seems doesnt works. I have this error, still learning yii
Trying to get property of non-object D:\xampp\htdocs\mou\protected\views\mou\view.php(26)
Did i miss something? thanks before.
D:\xampp\htdocs\mou\protected\views\mou\view.php(26)
14 'value'=>Yii::app()->dateFormatter->format('dd/MM/yyyy',$model->tgl_perjanjian),
15 ),
16 array(
17 'name'=>'tgl_awal',
18 'value'=>Yii::app()->dateFormatter->format('dd/MM/yyyy',$model->tgl_awal),
19 ),
20 array(
21 'name'=>'tgl_akhir',
22 'value'=>Yii::app()->dateFormatter->format('dd/MM/yyyy',$model->tgl_akhir),
23 ),
24 array(
25 'name'=>'Mitra KY',
26 'value'=>$model->mitra_mous->mitra->nama,
27 ),
28 'lingkup_kerjasama',
29 'penandatangan',
30 'jabatan_penandatangan',
31 array(
32 'name'=>'file',
33 'type'=>'raw',
34 'value'=>CHtml::link($model->file,Yii::app()->baseUrl . '/files/mou/' .$model->file),
35 ),
36 ),
37 )); ?>
this is my models Mitra.php
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(
'jenis0' => array(self::BELONGS_TO, 'JenisMitra', 'jenis'),
'kab0' => array(self::BELONGS_TO, 'Wilayah', 'kab'),
'prov0' => array(self::BELONGS_TO, 'Wilayah', 'prov'),
'mitra_mous' => array(self::HAS_MANY, 'MitraMou', 'mitra_id'),
);
}
and this is models Mou.php
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(
'mitra_mous' => array(self::HAS_MANY, 'MitraMou', 'mou_id'),
'mitras' => array(self::HAS_MANY, 'Mitra', 'mitra_id','through'=>'mitra_mous'),
);
}
</div>