28
December
$query = \Drupal::database()->select('node', 'n'); $query->fields('n', ['nid','type']); $query->condition('type', array('basic'), 'IN'); // Basic is content type $query->leftJoin('node__field_user_ref', 'UID', "n.nid = UID.entity_id"); // field_user_ref is entity field for user reference $query->condition('UID.field_user_ref_target_id', NULL, 'IS NOT NULL'); $pager = $query->extend('Drupal\Core\Database\Query\PagerSelectExtender')->limit(50); $results = $pager->execute()->fetchAll();
© 2023.ZedAngle. All Rights Reserved.