2 class ObservedPersonObserver
extends AkObserver
4 function update($state)
8 case "new person created" :
16 function afterCreate(&$record)
18 echo $record->get("first_name")." has been email with account details";
19 $this->logNotified($record,__FUNCTION__
);
22 function afterSave(&$record){$this->logNotified($record,__FUNCTION__
);}
23 function afterValidationOnCreate(&$record){$this->logNotified($record,__FUNCTION__
);}
24 function afterValidationOnUpdate(&$record){$this->logNotified($record,__FUNCTION__
);}
25 function beforeSave(&$record){$this->logNotified($record,__FUNCTION__
);
26 if(!empty($record->city
) && $record->city
== "Carlet")
28 $record->set('state',"Valencia");
31 function beforeCreate(&$record){$this->logNotified($record,__FUNCTION__
); }
32 function beforeValidationOnCreate(&$record){$this->logNotified($record,__FUNCTION__
);}
33 function beforeValidation(&$record){$this->logNotified($record,__FUNCTION__
);}
34 function afterValidation(&$record) {$this->logNotified($record,__FUNCTION__
);}
36 function logNotified(&$record, $function)
38 if(!isset($record->notified_observers
[$function])){
39 $record->notified_observers
[$function] = 0;
41 $record->notified_observers
[$function]++
;