Advertisement
petrabarus

Untitled

Oct 11th, 2012
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1. //protected/components/helpers/SpellHelper.php
  2.  
  3. class SpellHelper {
  4.     public static function spell($number){
  5.         //implement function put to $result
  6.         return $result;
  7.     }
  8. }
  9. //protected/components/behaviors/SpellBehavior.php
  10. class SpellBehavior {
  11.     public function spell($attribute){
  12.         $model = $this->owner;
  13.         $val = $model->getAttribute($attribute);
  14.         if (isset($val) && is_int($val))
  15.             return SpellHelper($val);
  16.         else
  17.             return NULL;
  18.     }
  19. }
  20.  
  21. class Model extends CModel {
  22.     public function behaviors(){
  23.         return array(
  24.             'behavior' => 'SpellBehavior',
  25.         );
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement