I have been thinking about this. And still dont see why this happened this way. First of all, this function extends ActiveRecord. Secondly all the other findX function return an instance of ActiveRecord, e.g. find(, findOne, findAll( etc…
If you wanted to allow the user to get the Active Query (Which is a perfectly reasonable request) why dont we give the function a different name, and leave the old one there. Or even make the old one return $one?static::newFuncitonName($condition)->one():static::newFunctionName($condition)->all();
Anyway I have fixe my code using the below which is not really ideal.
public static function findByConditionLayer2($condition, $one=false)
{
$matches = [];
if(preg_match('/([0-9]*)\.([0-9]*)\.([0-9]*)\-/', Yii::getVersion(), $matches))
{
if($matches[2] >= 3 && $matches[0]>=2) //less than 2.0.3
{
return parent::findByCondition($condition, $one); //Has To Return An Active Record.
}
else
{
$activeQuery = parent::findByCondition($condition);
return $one?$activeQuery->one():$activeQuery->all(); //Has to return an ActiveDBQuery
}
}
}