/** * Получить товар данной фотографии * @return yii\db\ActiveQuery */ public function getGood() { return $this->hasOhe(Photo::className(), ['goood_id' => 'id']); }
public function getMainPhoto() { return $this->hasMany(Photo::className(), ['good_id' => 'id'])->where('main=1'); }