Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

External Filter Validator Function?

$
0
0
Well,

We may use the filter validators in models this way:

public function rules()
{
   return array
   (
      array('myAttribute', 'filter', 'filter' => array($this, 'someFunction')),
   }
}

public function someFunction($attribute)
{
   return 'Ho ho ho ' . $attribute;
}


This is working well presuming 'someFunction' is defined within the model class. But how to use a 'shared' library of filter functions - e.g. function stored in a helper file?

Any ideas? - Thanks ahead!

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>