Retrieves entities matching a given set of conditions.
This class allows finding entities based on entity properties (for example, node->changed), field values, and generic entity meta data (bundle, entity type, entity ID, and revision ID). It is not possible to query across multiple entity types. For example, there is no facility to find published nodes written by users created in the last hour, as this would require querying both node->status and user->created.
Normally we would not want public properties on the object, as that could allow the object's state to become inconsistent. However, this class's standard use case involves primarily code that does need to have direct access to the collected properties in order to handle alternate execution routines. We therefore use public properties for simplicity. Note that code that is creating and running a field query should still use the appropriate methods to add conditions on the query.
Storage engines are not required to support every type of query. By default, an EntityFieldQueryException will be raised if an unsupported condition is specified or if the query has field conditions or sorts that are stored in different field storage engines. However, this logic can be overridden in hook_entity_query_alter().
Also note that this query does not automatically respect entity access restrictions. Node access control is performed by the SQL storage engine but other storage engines might not do this.
Hierarchy
- class EntityFieldQuery
Expanded class hierarchy of EntityFieldQuery
File
- core/
modules/ entity/ entity.query.inc, line 44 - Entity query API.
Members
Name![]() |
Modifiers | Type | Description |
---|---|---|---|
EntityFieldQuery:: |
public | function | Enables sortable tables for this query. |
EntityFieldQuery:: |
constant | Indicates that both deleted and non-deleted fields should be returned. | |
EntityFieldQuery:: |
public | function | Restricts a query to a given range in the result set. |
EntityFieldQuery:: |
public | function | Determines the query callback to use for this entity query. |
EntityFieldQuery:: |
protected | function | Queries entity tables in SQL for property conditions and sorts. |
EntityFieldQuery:: |
public | function | Orders the result set by an entity-specific property. |
EntityFieldQuery:: |
public | function | Adds a condition on an entity-specific property. |
EntityFieldQuery:: |
public | function | Enables a pager for the query. |
EntityFieldQuery:: |
function | Gets the total number of results and initialize a pager for the query. | |
EntityFieldQuery:: |
function | Finishes the query. | |
EntityFieldQuery:: |
public | function | Orders the result set by a given field column. |
EntityFieldQuery:: |
public | function | Adds a condition on the field language column. |
EntityFieldQuery:: |
public | function | Adds a condition on the field delta column. |
EntityFieldQuery:: |
public | function | Adds a condition on field values. |
EntityFieldQuery:: |
public | function | Executes the query. |
EntityFieldQuery:: |
public | function | Orders the result set by entity-generic metadata. |
EntityFieldQuery:: |
public | function | Adds a condition on entity-generic metadata. |
EntityFieldQuery:: |
public | function | Filters on the data being deleted. |
EntityFieldQuery:: |
public | function | Sets the query to be a count query only. |
EntityFieldQuery:: |
public | function | Queries the current or every revision. |
EntityFieldQuery:: |
public | function | Adds a tag to the query. |
EntityFieldQuery:: |
public | function | Adds additional metadata to the query. |
EntityFieldQuery:: |
protected | function | Adds the given condition to the proper condition array. |
EntityFieldQuery:: |
public | function | Adds a condition to an already built SelectQuery (internal function). |
EntityFieldQuery:: |
public | property | A list of the tags added to this query. |
EntityFieldQuery:: |
public | property | The query range. |
EntityFieldQuery:: |
public | property | List of property conditions. |
EntityFieldQuery:: |
public | property | The query pager data. |
EntityFieldQuery:: |
public | property | The ordered results. |
EntityFieldQuery:: |
public | property | List of order clauses. |
EntityFieldQuery:: |
public | property | A list of metadata added to this query. |
EntityFieldQuery:: |
public | property | A list of field arrays used. |
EntityFieldQuery:: |
public | property | List of field meta conditions (language and delta). |
EntityFieldQuery:: |
public | property | List of field conditions. |
EntityFieldQuery:: |
public | property | The method executing the query, if it is overriding the default. |
EntityFieldQuery:: |
public | property | Associative array of entity-generic metadata conditions. |
EntityFieldQuery:: |
public | property | Query behavior for deleted data. |
EntityFieldQuery:: |
public | property | TRUE if this is a count query, FALSE if it isn't. |
EntityFieldQuery:: |
public | property | TRUE if the query has already been altered, FALSE if it hasn't. |
EntityFieldQuery:: |
public | property | Flag indicating whether this is querying current or all revisions. |