Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By dawehner on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Description:
As a new feature the entity Query, the successor of EntityFieldQuery (see http://drupal.org/node/1827278),
got a way to add joins.
There is no active way to define a join, though sub-entities in your conditions will automatically be joined.
Let's take the classical example of listing nodes, with an author with a username starting with a certain string ("cat").
Drupal::entityQuery('node')
->condition('uid.entity.name', 'cat', 'STARTS_WITH')
->execute();
If you still want to filter by the uid it still works the same:
Drupal::entityQuery('node')
->condition('uid', 1)
->execute();
Note that this is not yet working because the node entity type is not yet converted to the new Entity system.
Impacts:
Module developers