yii - using relation HAS_ONE to get data from the related table to display in list page

前端 未结 2 1459
小鲜肉
小鲜肉 2021-01-26 00:39

I have two tables

big (id, bigs_name, smallid),

small(id, smallguys_name)

therefore two models - big and small

i have used the following relatio

2条回答
  •  无人共我
    2021-01-26 01:12

    You should like this in big model for relation to small from big,

    'has_small'  => array(self::BELONGS_TO, 'small', 'smallid');
    

提交回复
热议问题