Answer the question
In order to leave comments, you need to log in
How to get the first letter of a string field using DQL ?
How to get the first letter of a string field using DQL ? I tried using the LEFT([field],1) function, but it gives an error.
Answer the question
In order to leave comments, you need to log in
Assumptions:
- the doctrine does not understand such a function. You can solve the problem like this
- if you call getResult on the received query, then in any case you will get an error, because the doctrine does not know which field to map the result to. To do this, you need to change
to
and call not getResult, but getArrayResult, for example.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question