how do i type cast varchar to int in relation
public function getOmsOrderDetail()
{
return $this->hasOne(CompanyProduct::className(), [ 'product_id'=> CAST('product_id',INT)])
->viaTable('oms_order_detail', ['order_master_id' => 'order_master_id'];
}
CAST(‘product_id’,INT) this gives error as Call to undefined function app\models\CAST()
and CAST(‘product_id’ AS INT) gives syntax error, unexpected ‘AS’ (T_AS)
while in sql query CAST(‘product_id’ AS INT) is working just in yii2 model not working…