controllers/AppController.php
/**
     * Displays relation between patient and employee
     * @param integer $id
     * @return mixed
     */
Displays relation between patient and employee
@param integer $id
@return mixed
Displays relation between patient and employee @param integer $id @return mixed
public function actionView($id)
    {
        $assigned = UsersPacientes::find()
            ->innerJoin('pacientes','`users_pacientes`.`pacientes_id` = `pacientes`.`id`')
            ->where(['users_id' => $id,])
            ->all();
        $pacientesQuery = (new \yii\db\Query())->select('id')->from('pacientes')
            ->innerJoin('users_pacientes','`users_pacientes`.`pacientes_id` = `pacientes`.`id`')
            ->where(['users_pacientes.users_id' => $id]);
        $notAssigned = Pacientes::find()
            ->where(['NOT IN','id',$pacientesQuery])
            ->all();
        $user = $this->findModel($id);
        return $this->render('view', [
            'assigned'=>$assigned,
            'notAssigned'=>$notAssigned,
            'user'=>$user,
        ]);
    }
public function actionView ( $ id ) { $ assigned = UsersPacientes :: find ( ) -> innerJoin ( 'pacientes' , '`users_pacientes`.`pacientes_id` = `pacientes`.`id`' ) -> where ( [ 'users_id' => $ id , ] ) -> all ( ) ; $ pacientesQuery = ( new \ yii \ db \ Query ( ) ) -> select ( 'id' ) -> from ( 'pacientes' ) -> innerJoin ( 'users_pacientes' , '`users_pacientes`.`pacientes_id` = `pacientes`.`id`' ) -> where ( [ 'users_pacientes.users_id' => $ id ] ) ; $ notAssigned = Pacientes :: find ( ) -> where ( [ 'NOT IN' , 'id' , $ pacientesQuery ] ) -> all ( ) ; $ user = $ this -> findModel ( $ id ) ; return $ this -> render ( 'view' , [ 'assigned' => $ assigned , 'notAssigned' => $ notAssigned , 'user' => $ user , ] ) ; }
Displays relation between patient and employee
 @param integer $id
 @return mixed
Displays relation between patient and employee @param integer $id @return mixed