Skip to main content

Entity API

Displaying 1 - 4 of 4

entityQuery intro and examples

A node can include a few fields.
Every field is a table in the database.
So If I need to find a specific node, doing it with SQL means doing complicated queries, which might have few joins and many conditions, The Drupal platform created a simpler way to deal with it: EntityQuery

DrupalVIP technical notebook & support

$query = \Drupal::entityQuery('node')
  ->condition('type', 'page')
  ->condition('field_some_field', 14)
  ->accessCheck(TRUE);
$results = $query->execute();

How to code Entity/Node/Account Fields ? get, set and create

Retrieving field values in entities is fairly simple, but there are several ways to do this. 

Let's see how best to work with field values in custom code. 

You can always see the latest information on working with fields on the official website:

https://www.drupal.org/docs/8/api/entity-api/working-with-the-entity-api

 

In this article, we will look at examples of working with values. 

You don't have to remember how to code the fields work, just remember to return to this page.