public function getEntitiesByIds($identifier, array $values)
    {
        $values = array_values(array_filter($values, function ($v) {
            return !empty($v);
        }));

        if (0 === count($values)) {
            return [];
        }

        /* performance: if we could figure out whether the query builder is
         * "empty" (that is only checking for the class) we could optimize this
         * to a $this->dm->findMany(null, $values)
         */

        $qb = clone $this->queryBuilder;
        $alias = $qb->getPrimaryAlias();
        $where = $qb->andWhere()->orX();
        foreach ($values as $val) {
            $where->same($val, $alias);
        }

        return $this->getResult($qb);
    }