/** * @return \yii\db\ActiveQuery */ public function getContract() { if ($this->getContractType() == self::CONTRACT_TYPE) { return $this->hasOne(Contract::className(), ['id' => 'contract_id']); } elseif ($this->getContractType() == self::MEMBERSHIP_TYPE) { return $this->hasOne(Membership::className(), ['id' => 'contract_id']); } else { return null; } }
/** * @return \yii\db\ActiveQuery */ public function getContracts() { return $this->hasMany(Contract::className(), ['command_from_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getContracts() { return $this->hasMany(Contract::className(), ['season_id' => 'id']); }