Hello. I dont know if there is another way to get this:
UserModel.php
public function behaviors()
{
//I use array_merge() because UserModel extends from another custom model.
return
array_merge(
parent::behaviors(),
[
MyBehavior::className(),
]
);
}
public function rules()
{
return
array_merge(
MyBehavior::theRules(),
[
list of UserModel rules...
]
);
MyBehavior.php
class MyBehavior extends Behavior
{
public static function theRules()
{
return [
[['attr'],'file']
];
}
....
}
My question is: Is there any another way to inherit the rules from MyBehavior to UserModel with no static calling MyBehavior::theRules() on UserModel::rules() ?