add cassaopen/default account behaviors

This commit is contained in:
2016-01-12 17:19:34 +01:00
parent 7c584a0779
commit fbb2d7e5dc
6 changed files with 95 additions and 2 deletions

View File

@@ -194,6 +194,8 @@ class AccountState extends \common\models\BaseFitnessActiveRecord
* Read last accountstates
* @param $type int the type of accountstate to load
* @param $user $id of user to load the account
* @return common\models\AccountState
*
* */
public static function readLast($type, $user = null,$account = null){
$result = null;
@@ -202,9 +204,13 @@ class AccountState extends \common\models\BaseFitnessActiveRecord
if ( isset($type)){
$query->andWhere(['account_state.type' => $type]);
}
if ( $account ){
if ( isset( $account ) ){
$query->andWhere(["account_state.id_account" => $account ]);
}
if ( isset( $user ) ){
$query->andWhere(["account_state.id_user" => $user ]);
}
$query->limit(1);