add default account to frontend

This commit is contained in:
2015-10-26 07:49:10 +01:00
parent 0c92fdf167
commit 01da3c470c
45 changed files with 948 additions and 220 deletions

View File

@@ -0,0 +1,42 @@
<?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;
}
}