<?php
namespace common\components;

use yii\base\Behavior;
use common\models\Account;

class AccountAwareBehavior extends Behavior{
	
	
	public function getAccountName(){
		$result = "";
		$account = $this->owner->account;
		if (isset($account)){
			$result  = $account->name;
		}
		return $result;
	}

	
	public function getAccount(){
		return $this->owner->hasOne( Account::className(), ["id_account" =>"id_account" ] ) ;
	}
	
}