I would like to debug select query and I use the next code, for example:

$connection = \Drupal::service('database');
$query = $connection->select('node', 'node');
$query->fields('node', ['nid'])
  ->condition('node.type', 'page')
// Debug.

But this print the query with placeholders, that is, with ":db_condicion_placeholder_1", etc. I would like to get the query with its custom parameters values. For example, if I add a condition for some field equals to "M", I would like to get the raw sql with this condition: some_field="M".
Is there any way to get it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.