FieldCondition in an EntityQuery for media is causing a website error

by Madam Adam   Last Updated December 29, 2017 01:07 AM

This entityQuery in a theme preprocess function in Drupal 8 is working great:

$query = \Drupal::entityQuery('media')
    ->condition('status', 1)
$result = $query->execute();

But as soon as I add this fieldCondition for a boolean field, I get a website error:

$query = \Drupal::entityQuery('media')
    ->condition('status', 1)
    ->fieldCondition('field_flagged', 'value', '1', '=');
$result = $query->execute();

What is wrong in the above code?

Tags : entities


Related Questions




How to create a custom template for entities?

Updated April 07, 2015 03:03 AM


Drupal 8 Custom Entities from a UI?

Updated July 14, 2015 15:03 PM