当事件触发的时候...
会循环所有behavior的events 为ower添加事件.....AttributeBehavior 为事件添加如下方法
1
2
3
4
5
6
7
8
9
10 |
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的值...
AttributeBehavior,布布扣,bubuko.com
原文:http://www.cnblogs.com/zhepama/p/3602928.html