/** * * @return \conquer\oauth2\models\Client */ public function getClient() { if (is_null($this->_client)) { if (empty($this->client_id)) { $this->errorServer('Unknown client', Exception::INVALID_CLIENT); } if (!($this->_client = Client::findOne(['client_id' => $this->client_id]))) { $this->errorServer('Unknown client', Exception::INVALID_CLIENT); } } return $this->_client; }
/** * @return \yii\db\ActiveQuery */ public function getClient() { return $this->hasOne(Client::className(), ['client_id' => 'client_id']); }
/** * Finds the Client model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Client the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Client::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }