Hi all!
yii2 is adding " ` " symbols in the wrong places in my
->orderBy()
part of the query and it is breaking the query.
Is there a way to remove this behaviour? Or maybe force yii2 to take what’s written in orderBy as plain text? It’s in a search model class so I can’t use (or dont know how to) use
findBySql()
in there as then the
->andFilterWhere(['like', 'foo.bar', $this->bar])
parts of the code don’t seem to work anymore.
This is my orderBy:
$query->orderBy("LENGTH(REPLACE(`apgerbi`.`artikuls`,`kolekcijas`.`nosaukums`, '' ) ) ASC, REPLACE(`apgerbi`.`artikuls`,`kolekcijas`.`nosaukums`, '' ) ASC");
yii2 is transforming it to this:
LENGTH(REPLACE(`apgerbi`.`artikuls`, `kolekcijas`.`nosaukums`, `'' ) )`, REPLACE(`apgerbi`.`artikuls`, `'' )`
which is breaking it.