fitness-web/frontend/models/AccountSelect.php

43 lines
750 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;
}
}