According to the documentation for the condition() function, you can append columns to a field name, but I haven't found a way to make a condition on the referenced entity's type.
// Something like this? $query->andConditionGroup()->condition($referenceFieldName, $someId) ->condition("$fieldName.entity:type", ['character', 'movie'], 'IN')
Let's say with the above I am querying for
articles that have a reference to the ID in
$someId and that reference is to a content type of either
movie. Is something like this possible with
Background: I'm using the Dynamic Entity Reference module, which allows me to make a reference field that can point to either a taxonomy term or a piece of content. I want to query for references to content in that field, but am concerned that there could be an ID overlap. That is, a taxonomy term and
character for example that both have the ID 123. If I am searching for the ID 123, I would only want
articles that have references to the
movies with the ID 123, not any taxonomy terms with the ID 123.