Doctrine dql select as with spaces
Asked Answered
P

0

6

I would like to know if it's possible to alias a column name with spaces in for example

$query = "SELECT u.firstName AS 'First Name' FROM User u";
$result = $query->getResult( Query::HYDRATE_ARRAY );
Predecease answered 7/1, 2017 at 8:32 Comment(4)
I don't think this is possible using doctrine DQL, your chance perhaps is to get a PDO instance and write a native SQL query which must support what you want.Fiji
I have managed to get this working using native query and using the result mapping class, but obviously doesn't use my soft delete filter for example, so hence why having to use dqlPredecease
Have you tried using back ticks `First Name`? Doubt if it will work but maybe.Town
Yes I've tried that alreadyPredecease

© 2022 - 2024 — McMap. All rights reserved.