diff --git a/src/contracts/Gateway/AbstractDoctrineDatabase.php b/src/contracts/Gateway/AbstractDoctrineDatabase.php index ef5c0fe..c8a9b2d 100644 --- a/src/contracts/Gateway/AbstractDoctrineDatabase.php +++ b/src/contracts/Gateway/AbstractDoctrineDatabase.php @@ -126,13 +126,13 @@ public function countBy($criteria): int { $metadata = $this->getMetadata(); $qb = $this->createBaseQueryBuilder(); + $this->applyInheritance($qb); $identifierColumn = $metadata->getIdentifierColumn(); $tableAlias = $this->getTableAlias(); $platform = $this->connection->getDatabasePlatform(); $qb->select($platform->getCountExpression($tableAlias . '.' . $identifierColumn)); - $this->applyInheritance($qb); $this->applyCriteria($qb, $criteria); return (int)$qb->execute()->fetchOne();