I have a repeated function in a couple of my models that all it does is generate a random salt string. Instead of repeating this code in each of the models that requires a generated salt, should i create this as a component or widget or module? Here is the actual function;
Also you can extend CActiveRecord class with your own class, e.g. MyClass extends CActiveRecord, where MyClass will have a protected function randomSalt. And a couple of your models will extend this class.