fitness-web/frontend/models/AccountSelect.php
2015-10-30 09:28:58 +01:00

51 lines
898 B
PHP

<?php
namespace frontend\models;
use Yii;
use yii\base\Model;
use common\models\Account;
/**
* AccountSearch represents the model behind the search form about `common\models\Account`.
*/
class AccountSelect extends Model
{
public $id_account;
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_account', 'type'], 'integer'],
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
public function writeToSession(){
$account = Account::findOne($this->id_account);
Account::writeDefault($account);
return true;
}
/* */
public function attributeLabels(){
return [
'id_account' =>Yii::t('frontend/account', 'Account')
];
}
}