yii2 多条件搜索(like > < <> = ) 打印sql

如何打印sql语句

$products = TProductArt::find()
    - >select(['product_id','art_name','domain','price','final_price','discount_type','discount','art_expiry','image_large'])
    ->where($where)
    ->orderBy('score DESC')
    ->andWhere(['>', 'art_expiry', $after_2_minute])
    ->andWhere(['<', 'art_start', $current_date])
    ->andWhere(['<>', 'image_large',''])
    ->andWhere($search_like)
    ->andWhere($search_price)
    ->limit(20)
    ->createCommand()->getRawSql();


public static function searcharray($search, $domain, $group,$price)
{
    $where = array();
    if(in_array($domain, self::$domainsList)){
        $where['domain']=$domain;
    }
    $search_like=array();
    if ($search!='')
    {
        $search = trim($search);
        $search = preg_replace('!\s+!', ' ', $search);  // replaces multiple space with single space
        $search_like = ['or like', 'art_name',explode(" ", $search)];
    }
    if ($group!='')
    {
        if (in_array($group, Yii::$app->params['amazon_product_groups']))
        {
            $where['art_product_group']=$group;
        }
    }
    $search_price=array();
    if(floatval($price)>0)
    {
        $search_price=['<', 'final_price', $price];
    }
    $where['status']=0;
    $after_2_minute = date('Y-m-d H:i:s', time() + 120);
    $current_date = date('Y-m-d H:i:s', time());
    return $products = TProductArt::find()
        ->select(['product_id','art_name','domain','price','final_price','discount_type','discount','art_expiry','image_large'])
        ->where($where)
        ->orderBy('score DESC')
        ->andWhere(['>', 'art_expiry', $after_2_minute])
        ->andWhere(['<', 'art_start', $current_date])
        ->andWhere(['<>', 'image_large',''])
        ->andWhere($search_like)
        ->andWhere($search_price)
        ->limit(20)
     //   ->createCommand()->getRawSql();
        ->asarray()
        ->all()
    ;


}