Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. $query = Drupal::entityQuery('entity_test');
  2. $default_langcode_group = $query->andConditionGroup()
  3. ->condition('user_id', $properties[$default_langcode]['user_id'], '=', $default_langcode)
  4. ->condition('name', $properties[$default_langcode]['name'], '=', $default_langcode);
  5. $langcode_group = $query->andConditionGroup()
  6. ->condition('name', $properties[$langcode]['name'], '=', $langcode)
  7. ->condition("$this->field_name.value", $field_value, '=', $langcode);
  8. $result = $query
  9. ->condition('langcode', $default_langcode)
  10. ->condition($default_langcode_group)
  11. ->condition($langcode_group)
  12. ->sort('name', 'ASC', $default_langcode)
  13. ->execute();
  14.  
  15. $query = Drupal::entityQuery('node')
  16. ->condition('status', 1)
  17. ->condition('changed', REQUEST_TIME, '<')
  18. ->condition('title', 'cat', 'CONTAINS')
  19. ->condition('field_tags.entity.name', 'cats');
  20.  
  21. $nids = $query->execute();
  22.  
  23. $nodes = Drupal::entityTypeManager()
  24. ->getStorage('node')
  25. ->loadByProperties(['title' => $title]);
  26.  
  27. if ($node = reset($nodes)) {
  28. // found $node that matches the title
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement