error when calling mysql math functions with query builder

I am using yii2.0.3 on nginx with mariadb (mysql).

This code:




        $lat = '33.45678';

        $locations = (new \yii\db\Query())

                ->select(['locationId'])

                ->from(['Locations'])

                ->where( ['<>', 'Locations.lat', '0'])

                ->andwhere( ['<>', 'Locations.lng', '0'] )

 error line ->>          ->andwhere( [ '>', ( 3959 * acos( cos( radians(':lat') )))])

                ->addParams([':lat' => $lat])

                ->limit(10)

                ->all;

generates the error on the last ->andwhere statement:




PHP Fatal Error – yii\base\ErrorException


Call to undefined function app\models\radians()



The original query statement that this snippet came from works fine in phpmyadmin’s query box.

Is this a problem with my usage of query builder, or is this a problem with query builder itself?

thanks!

-John

It appears you’re missing quotes around your expression. And very likely an operand.