ActiveRecord::getRelation("????", false) throw ArgumentCountError exception
webinjaz opened this issue · comments
Mohammad Louai Haimour commented
What steps will reproduce the problem?
1 - add a static function with parameters and it`s name starts with "get" in an ActiveRecored sub class,
ex:
public static function getHint($param)
{
....
}
2- call $model->getRelation("hint", false);// $model is an instance of that ActiveRecord
What is the expected result?
getting null without error throwing
$model->getRelation("hint", false) // return null without error throwing
What do you get instead?
This Exception:
ArgumentCountError
Too few arguments to function getHint(), 0 passed in \vendor\yiisoft\yii2\db\BaseActiveRecord.php on line 1248 and exactly 2 expected
Additional info
Q | A |
---|---|
Yii version | 2.0.49.3 |
PHP version | 7.4.26 |
Operating system | windows |
Bizley commented
If you want to use it like that you must make $param optional.