$fileQueryBuilder->columns(
[
"id" => "d.discovered_file_id",
"company_name" => "d.company_name"
]
);
This is the part of my query builder where I mention the column names to be selected/displayed. Can I handle the 'company_name' field to show it's value if it has one, and something like 'Not available' if it's empty, in this part of the query builder itself? Is there a way of doing that, like using a CASE WHEN same as in SQL?
What I tried- CASE WHEN d.company_name IS NOT NULL THEN d.company_name ELSE 'Not available' END => d.company_name
, but this doesn't work.
Isn't IF better in this case?
IF(d.company_name IS NOT NULL, d.company_name, 'Not available') as company_name
Also PHQL only supports case syntac like this:
CASE column WHEN value THEN some expression ELSE some expression END