<?php
namespace common\components;

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

class UserAwareBehavior extends Behavior{
	
	
	public function getUserName(){
		$result = "";
		$user = $this->owner->user;
		if (isset($user)){
			$result  = $user->username;
		}
		 
		return $result;
	}

	
	public function getUser(){
		return $this->owner->hasOne( User::className(), ["id" =>"id_user" ] ) ;
	}
	
}