Drupal 9 select node data with query conditions using entity type manager

To select node data with query conditions using the Entity Type Manager in Drupal 9, you can use the following code:

$entityTypeManager = \Drupal::entityTypeManager();
$query = $entityTypeManager->getStorage('node')->getQuery();

// Add conditions to the query.
$query->condition('status', 1); // Published nodes only.
$query->condition('type', 'article'); // Only nodes of type 'article'.
$query->condition('field_category', 'news', 'IN'); // Only nodes with the category 'news'.

// Execute the query and get the result.
$nids = $query->execute();

// Load the nodes based on the result.
$nodes = $entityTypeManager->getStorage('node')->loadMultiple($nids);

In the above code, we first get an instance of the Entity Type Manager using \Drupal::entityTypeManager(). Then, we create a query object for the 'node' entity type using $entityTypeManager->getStorage('node')->getQuery(). We can then add conditions to the query using the condition() method. In this example, we add conditions to retrieve only published nodes of type 'article' with the category 'news'. Finally, we execute the query using execute() and load the nodes based on the result using $entityTypeManager->getStorage('node')->loadMultiple($nids).

Please note that you may need to adjust the field names and conditions based on your specific requirements.