I need to execute this SQL query using dynamic queries.
WHERE (node_field_data.status = 1)
AND (node__field_document_places.entity_id IN (SELECT entity_id FROM node__field_document_places where field_document_places_target_id = 51673))
This is the code I am using.
$connection = Database::getConnection();
$query = $connection->select('node_field_data', 'node_field_data');
$query->condition('node_field_data.status',1);
$query->condition('node__field_document_places.entity_id',[ -- Can I do this here somehow? -- ], "IN");
I could technically run a separate query and put the IDs in an array. But I was hoping to avoid executing two different queries.
Is there a way to do this using dynamic queries?