AttributeBehavior

 当事件触发的时候...

 

会循环所有behavior的events  为ower添加事件.....AttributeBehavior  为事件添加如下方法

	public function evaluateAttributes($event)
	{
		if (!empty($this->attributes[$event->name])) {
			$attributes = (array)$this->attributes[$event->name];
			$value = $this->getValue($event);
			foreach ($attributes as $attribute) {
				$this->owner->$attribute = $value;
			}
		}
	}

  

 

可以看到..循环所有特性...根据getValue获取所有特性...并设置owner的值...

posted @ 2014-03-16 04:26  zhepama  阅读(230)  评论(0编辑  收藏  举报