user card search fix 3

This commit is contained in:
Kavalar 2023-05-04 18:05:24 +03:00
parent 48463110bd
commit c5850bda46

View File

@ -52,14 +52,16 @@ class UserCardSearch extends UserCard
} else { } else {
$manager = Manager::findOne(Yii::$app->user->id); $manager = Manager::findOne(Yii::$app->user->id);
if (!$manager){ if (!$manager){
return false; $query = UserCard::find()->where(['id' => 0]);
} }
$employeeIdList = ManagerEmployee::find() else {
->where(['manager_id' => $manager->id]) $employeeIdList = ManagerEmployee::find()
->select('employee_id') ->where(['manager_id' => $manager->id])
->column(); ->select('employee_id')
->column();
$query = UserCard::find()->where(['in', 'user_card.id', $employeeIdList]); $query = UserCard::find()->where(['in', 'user_card.id', $employeeIdList]);
}
} }
$query->distinct() $query->distinct()