<?php
namespace common\components;

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

class DiscountAwareBehavior extends Behavior{
	
	
	public function getDiscountName(){
		$result = "";
		$discount = $this->owner->discount;
		if (isset($discount)){
			$result  = $discount->name;
		}
		return $result;
	}

	
	public function getDiscount(){
		return $this->owner->hasOne( Discount::className(), ["id_discount" =>"id_discount" ] ) ;
	}
	
}