<?php
namespace common\components;

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

class CurrencyAwareBehavior extends Behavior{
	
	
	public function getCurrencyName(){
		$result = "";
		$currency = $this->owner->currency;
		if (isset($currency)){
			$result  = $currency->name;
		}
		return $result;
	}

	
	public function getCurrency(){
		return $this->owner->hasOne( Currency::className(), ["id_currency" =>"id_currency" ] ) ;
	}
	
}