Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //protected/components/helpers/SpellHelper.php
- class SpellHelper {
- public static function spell($number){
- //implement function put to $result
- return $result;
- }
- }
- //protected/components/behaviors/SpellBehavior.php
- class SpellBehavior {
- public function spell($attribute){
- $model = $this->owner;
- $val = $model->getAttribute($attribute);
- if (isset($val) && is_int($val))
- return SpellHelper($val);
- else
- return NULL;
- }
- }
- class Model extends CModel {
- public function behaviors(){
- return array(
- 'behavior' => 'SpellBehavior',
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement