How to write replace string function inside YII2 query

I have a Mysql query which selects column based on the replace string values passed to a column

SELECT * FROM Table WHERE REPLACE(column_name, ‘.’, ‘’) = ‘value’;
In the above query i remove dot values from the column_name of the table and i pass values with out dots and it works fine.

Now i need to make this query to work in YII2 query

I have a query in YII2 like below,

$Table= Table::findOne([ column_name => \Yii::$app->request->post(‘value’)]);
How can i make the first query condition work in YII2 query , Thanks in advance :slight_smile:

Hi,

You can use \yii\db\Expression to pass custom SQL expression to your where clause.