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);
    }
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);
    }
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 ) ; }
Returns an array of documents matching the given identifiers.

@param string $identifier The identifier field of the object. This method
is not applicable for fields with multiple
identifiers.
@param array  $values     the values of the identifiers

@return array the entities
Returns an array of documents matching the given identifiers .