Submitted by Thao Huynh on December 22, 2018 - 10:38
<?php
/**
* Debugging using the database connection.
*/
/** @var \Drupal\Core\Database\Connection */
$connection = \Drupal::service('database');
$query = $connection->select('node', 'node');
$query->fields('node', ['nid'])
->condition('node.type', 'page')
// Debug.
dump($query->__toString());
Submitted by Thao Huynh on December 5, 2018 - 15:19
/**
* Implements hook_query_QUERY_ID_alter().
*/
function mymodule_query_taxonomy_term_access_alter($query) {
/** @var \Drupal\Core\Database\Query\Select $query */
$conditions = &$query->conditions();
foreach ($conditions as $i => $condition) {
if (isset($condition['field']) && $condition['field'] === 't.default_langcode') {
unset($conditions[$i]);
}
}
}