public function getAffiliatePurchases() { return $this->hasMany(Purchase::className(), ['affiliate_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getPurchase() { return $this->hasOne(Purchase::className(), ['id' => 'purchase_id']); }