/** * @establish a relationship with client or website model */ public function getCow() { if ($this->belong_to == 1) { return $this->hasOne(Client::className(), ['id' => 'clients_or_webs_id']); } elseif ($this->belong_to == 2) { return $this->hasOne(Website::className(), ['id' => 'clients_or_webs_id']); } }
/** * @return \yii\db\ActiveQuery */ public function getClient() { return $this->hasOne(Client::className(), ['id' => 'client_id']); }
/** * @return \yii\db\ActiveQuery */ public function getIdClient() { return $this->hasOne(Client::className(), ['id' => 'id_client']); }
/** * @return \yii\db\ActiveQuery */ public function getClients() { return $this->hasMany(Client::className(), ['client_type_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getClients() { return $this->hasMany(Client::className(), ['discipline_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getClients() { return $this->hasMany(Client::className(), ['iddirection' => 'id']); }
public function getClient() { // GroupClient has_one Group via Group.id -> groups_id return $this->hasOne(Client::className(), ['id' => 'clients_id']); }