In sql I have this
AND oir.id IS NULL
AND IF(t.work_type = 'contract' AND te.status != 2, FALSE, TRUE)
and I don't know how to correct create custom DQL for this
IF(t.work_type = 'contract' AND te.status != 2, FALSE, TRUE)
help, give me dql please for this IF () I think logic like this
IF (confition and confition, (return if true), (return if false))
example return true or false
OR how interpretation this for queryBuilder ?
I don't remember if DQL support if
.. I think that no.
You can use case when ... then ... else ... end
instead.
AND oir.id IS NULL
AND (CASE WHEN t.work_type = 'contract' AND te.status != 2 THEN FALSE ELSE TRUE END) = TRUE
Why do you need so if
in where clause? You can use this expression without if
. Just t.work_type = 'contract' AND te.status != 2
without if
will return same result(true/false
) as with if
.