how to do entityQuery on default fields of a content type like title and apply condition on it or sort them using the title field

by Bishwash Sharma   Last Updated January 11, 2018 19:07 PM

I am using drupal 8. Every content type comes with the default fields Like "title" and it's stored in node_field_data table in database, I was wondering how we can query this field using entityQuery. I am querring other field names using it's machine name in the following way.

        $query = \Drupal::entityQuery('node');
        $query->condition('status', 1);
       $query->condition('type', 'team');
       $query->condition('type', 'character');
       $query->condition('field_character_eye_color', ['blue','brown'], 'IN');

        $query->sort('field_character_real_name', 'DESC');
        $query->condition('field_character_citizenship', 'U.S.A.');
       $query->condition('field_character_real_name', 'Miles Morales');

         $query->execute();

Any help would be greatly appreciated. Thanks



Related Questions



Querying a custom entity throws Exception

Updated April 11, 2017 10:07 AM


Is it important to use base table in query?

Updated March 16, 2016 08:03 AM

Query - Content type

Updated April 24, 2016 08:03 AM