add reception collection basics
This commit is contained in:
@@ -132,13 +132,14 @@ class Account extends \yii\db\ActiveRecord
|
||||
$query = Account::find();
|
||||
$query->innerJoinWith('userAccountAssignments');
|
||||
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id]);
|
||||
$query->andWhere(['status' => Account::STATUS_ACTIVE]);
|
||||
if ( $forceIncludeAccount == null){
|
||||
$query->andWhere(['status' => Account::STATUS_ACTIVE])->all();
|
||||
}else{
|
||||
$query->andWhere( ['or', ['status' => Account::STATUS_ACTIVE], ['id_account' => $forceIncludeAccount ] ])->all();
|
||||
}
|
||||
|
||||
|
||||
$query->orderBy( ['name' => SORT_ASC]);
|
||||
|
||||
$accounts = $query->all();
|
||||
return $accounts;
|
||||
}
|
||||
@@ -156,4 +157,21 @@ class Account extends \yii\db\ActiveRecord
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* read assigned account
|
||||
* */
|
||||
public static function readOne($idAccount){
|
||||
$accounts = null;
|
||||
|
||||
$query = Account::find();
|
||||
$query->innerJoinWith('userAccountAssignments');
|
||||
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id]);
|
||||
$query->andWhere(['status' => Account::STATUS_ACTIVE]);
|
||||
$query->andWhere(['account.id_account' => $idAccount]);
|
||||
$accounts = $query->one();
|
||||
|
||||
return $accounts;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user