나는 2 개의 모형이있다 : 웹 사이트를 위해 1 개, 제품을 위해 1 개;Yii 눈금 기둥 값
제품은 그가 웹 사이트 x에 속한다는 것을 알고 있습니다. 내가 가지고있는 제품 모델의 뷰 관리자에서
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(
'relation_website' => array(self::BELONGS_TO,'Website','website_id'),
);
}
: : 지금이 결과를 가지고
$dataProvider = $model->search();
$dataProvider->pagination->pageSize = 100;
$this->widget('zii.widgets.grid.CGridView', array(
'id' => 'product-grid',
'dataProvider' => $dataProvider,
'filter' => $model,
'columns' => array(
'id',
'product',
'price',
'currency',
array(
'name' => 'website_id',
'value' => $model->relation_website->website_id,
),
/*
'website_id',
'url_id',
*/
array(
'class' => 'CButtonColumn',
'template' => '{update}{delete}',
),
),
));
:
테이블 제품에서 나는 관계를 가지고 제품에 을 website_id 한1 노트북 Acer Aspire V3-571G-73614G50Maci 프로세서 인텔 ® 코어 ™ i7-3610QM 2.30GHz, 아이비 브리지, 4GB, 500GB, nVidia GeForce GT 640M 2GB, Linpus, Black 3099.99 RON 1,543,210 - 여기에이 값 대신 내가 원하는 지난 1
는 http://www.eshop.com/ 웹 사이트 모델에 속하는 테이블을 웹 사이트 테이블에 저장된 값을 출력하는1 노트북 에이서 Aspire V3-571G-73614G50Maii CU procesor 인텔 ® 비슷한 예는있다
...
'value' => '$data->relation_website->name'
...
: CoreTM i7-3610QM 2.30GHz, 아이비 브릿지, 4GB의 5백기가바이트, 엔비디아 지포스 GT 640M 2기가바이트, Linpus, 블랙 3099.99 RON http://www.domain.com/
'값'=> '$ data-> relation_website-> website', –