Search code examples
postgresqlsymfonydoctrine-ormdql

how to get array length in a doctrine query?


i'd like to know how to get the length of an array in a doctrine query? i use postgresql that has an array type and many functions to hundle arrays but i didn't find anything equivalent in doctrine, for instance i used:

SELECT a, abs(array_length(a.ssc,1)-array_length(a.ssb,1)) as d
FROM AbbPostBundle:Post a
order by d desc

but i got this error:

[Syntax Error] line 0, col 17: Error: Expected known function, got 'array_length'o?

so i wonder what can i do?


Solution

  • You have to create custom DQL functions for vendor specific functions.