Problem/Motivation
#2424791: Entity query hardcodes entity_reference and entity specifier allows adding relationship specifier to the EFQ. Sample usage can be found at https://www.drupal.org/node/2835034. EFQ doesn't accommodate relationship specifier for basefields.
Proposed resolution
See #7
Remaining tasks
Finalize the approach. Add tests.
User interface changes
None.
API changes
It replicates the API added in #2424791: Entity query hardcodes entity_reference and entity specifier for basefields.
Data model changes
None
Original report by @heddn
I'm using DER with the rng module. Rng has a base DER field for events. I've implemented https://www.drupal.org/node/2835034, but I always get a query exception in Tables::ensureEntityTable(), saying that 'event' property isn't found. It isn't. It is called 'event__target_id' and 'event__target_type'. Am I doing the query incorrectly?
/** @var \Drupal\commerce_product\Entity\ProductVariation $variation */
$variation = reset($variations);
$entityTypeId = $variation->getProduct()->getEntityTypeId();
$idKey = $this->entityTypeManager->getDefinition($entityTypeId)
->getKey('id');
$query = $this->registrationStorage->getQuery()
->condition("event.entity:$entityTypeId.$idKey", $variation->getProductId());
$count = $query->count()->execute();