I tried doing:

use \Drupal\Core\Entity\EntityInterface;
use \Drupal\Core\Entity\Query\EntityQueryInterface;

use Drupal\node\Entity\Node;
use Drupal\field\FieldConfigInterface;

$query = \Drupal::entityQuery('api_detail')
    ->condition('status', 1);
    
$nids = $query->execute();
$node = Node::node($nids);

But, when I load the page, it prompts an error:

"The website encountered an unexpected error. Please try again later."

Can anyone please help?

Thanks

Comments

rshafakian’s picture

You can try 

        $query = \Drupal::entityQuery('node');
        $query->condition('status', 1);
        $query->condition('type', 'my_content_type');
        $entity_ids = $query->execute();