src/EntityRepositoryTrait.php
public function findAllIdentifiers()
    {
        $metadata    = $this->getClassMetadata();
        $identifiers = $metadata->getIdentifier();
        $qb          = $this->createQueryBuilder();

        foreach ($identifiers as $field) {
            $qb->select($qb->alias($field));
        }

        return $qb->fetchAllScalar();
    }
public function findAllIdentifiers()
    {
        $metadata    = $this->getClassMetadata();
        $identifiers = $metadata->getIdentifier();
        $qb          = $this->createQueryBuilder();

        foreach ($identifiers as $field) {
            $qb->select($qb->alias($field));
        }

        return $qb->fetchAllScalar();
    }
Finds entity ids.

@return array
@throws \ReflectionException