<?php
namespace common\components;

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

class CustomerAwareBehavior extends Behavior{
	
	
	public function getCustomerName(){
		$result = "";
		$customer = $this->owner->customer;
		if (isset($customer)){
			$result  = $customer->name;
		}
		return $result;
	}

	
	public function getCustomer(){
		return $this->owner->hasOne( Customer::className(), ["id_customer" =>"id_customer" ] ) ;
	}
	
}