Search code examples
symfonydoctrinedql

REGEXP query exception in doctrine


I'm trying REGEXP in Doctrine for such condition WHERE CONCAT(",", setcolumn, ",") REGEXP ",(val1|val2|val3)," found at https://stackoverflow.com/a/26195280/1179841. I have added this in config.yml

orm:
    dql:
      string_functions:
        regexp: DoctrineExtensions\Query\Mysql\Regexp

However I still getting the error:

[2/2] QueryException: [Syntax Error] line 0, col 790: Error: Expected =, <, <=, <>, >, >=, !=, got 'REGEXP'

I use "beberlei/DoctrineExtensions": "1.0.*" in composer.json. Any idea?


Solution

  • You use it like WHERE REGEXP(CONCAT(",", setcolumn, ","), ",(val1|val2|val3),") = 1