yii\db\BaseActiveRecord::findByCondition PHP Method

findByCondition() protected static method

This method is internally called by BaseActiveRecord::findOne and BaseActiveRecord::findAll.
protected static findByCondition ( mixed $condition ) : yii\db\ActiveQueryInterface
$condition mixed please refer to [[findOne()]] for the explanation of this parameter
return yii\db\ActiveQueryInterface the newly created [[ActiveQueryInterface|ActiveQuery]] instance.
    protected static function findByCondition($condition)
    {
        $query = static::find();
        if (!ArrayHelper::isAssociative($condition)) {
            // query by primary key
            $primaryKey = static::primaryKey();
            if (isset($primaryKey[0])) {
                $condition = [$primaryKey[0] => $condition];
            } else {
                throw new InvalidConfigException('"' . get_called_class() . '" must have a primary key.');
            }
        }
        return $query->andWhere($condition);
    }