I have no idea how to set specified date format to query with CASE WHEN. What i try to do is to create a select that will look like one bellow.
$qb -> select('
CASE WHEN ps.paymentDate >= (new \DateTime(\'%Y-%m-01\')) THEN \'true\' ELSE \'false\' END as myVar
IF(ps.payment_date >= DATE_FORMAT(CURDATE(),\'%Y-%m-1\'),\'true\',\'false\') as myVar
$d = new \DateTime(); $sd = $d->format('Y-m-01'); $qb -> select("CASE WHEN ps.paymentDate >= '$sd' THEN 'true' ELSE 'false' END as myVar");
$q = "IF(ps.payment_date >= DATE_FORMAT(CURDATE(),'%Y-%m-01'),'true','false') as myVar";
NOTE: If you use single quotes inside a Double quoted string literal, you can dispence with all those escape characters which just server to confuse the eye. Also
$variables are automatically expanded inside a double quoted string.