You can easily access the SQL parameters using the following approach.
$result = $qb->getQuery()->getSQL();
$param_values = '';
$col_names = '';
foreach ($result->getParameters() as $index => $param){
$param_values .= $param->getValue().',';
$col_names .= $param->getName().',';
}
//echo rtrim($param_values,',');
//echo rtrim($col_names,',');
So if you printed out the $param_values
and $col_names
, you can get the parameter values passing through the sql and respective column names.
Note : If $param
returns an array, you need to re iterate, as parameters inside IN (:?)
usually comes is as a nested array.
Meantime if you found another approach, please be kind enough to share with us :)
Thank you!