public static function cleanValues(QueryBuilder $qb, $identifier, array $values)
    {
        // Guess type
        $entity = current($qb->getRootEntities());
        $metadata = $qb->getEntityManager()->getClassMetadata($entity);

        if (\in_array($metadata->getTypeOfField($identifier), ['integer', 'bigint', 'smallint'])) {
            $parameterType = Connection::PARAM_INT_ARRAY;

            // Filter out non-integer values (e.g. ""). If we don't, some
            // databases such as PostgreSQL fail.
            $values = array_values(array_filter($values, function ($v) {
                return (string) $v === (string) (int) $v;
            }));
        } elseif ('guid' === $metadata->getTypeOfField($identifier)) {
            $parameterType = Connection::PARAM_STR_ARRAY;
            $type = Type::getType(Type::GUID);
            $platform = $qb->getEntityManager()->getConnection()->getDatabasePlatform();

            // Like above, but we just filter out empty strings and invalid guid.
            $values = array_values(array_filter($values, function ($v) use ($type, $platform) {
                $guid = $type->convertToDatabaseValue($v, $platform);

                return !empty($guid) && '00000000-0000-0000-0000-000000000000' !== $guid;
            }));
        } else {
            $parameterType = Connection::PARAM_STR_ARRAY;
        }

        return [$parameterType, $values];
    }
public static function cleanValues(QueryBuilder $qb, $identifier, array $values)
    {
        // Guess type
        $entity = current($qb->getRootEntities());
        $metadata = $qb->getEntityManager()->getClassMetadata($entity);

        if (\in_array($metadata->getTypeOfField($identifier), ['integer', 'bigint', 'smallint'])) {
            $parameterType = Connection::PARAM_INT_ARRAY;

            // Filter out non-integer values (e.g. ""). If we don't, some
            // databases such as PostgreSQL fail.
            $values = array_values(array_filter($values, function ($v) {
                return (string) $v === (string) (int) $v;
            }));
        } elseif ('guid' === $metadata->getTypeOfField($identifier)) {
            $parameterType = Connection::PARAM_STR_ARRAY;
            $type = Type::getType(Type::GUID);
            $platform = $qb->getEntityManager()->getConnection()->getDatabasePlatform();

            // Like above, but we just filter out empty strings and invalid guid.
            $values = array_values(array_filter($values, function ($v) use ($type, $platform) {
                $guid = $type->convertToDatabaseValue($v, $platform);

                return !empty($guid) && '00000000-0000-0000-0000-000000000000' !== $guid;
            }));
        } else {
            $parameterType = Connection::PARAM_STR_ARRAY;
        }

        return [$parameterType, $values];
    }
public static function cleanValues ( QueryBuilder $ qb , $ identifier , array $ values ) { // Guess type $ entity = current ( $ qb -> getRootEntities ( ) ) ; $ metadata = $ qb -> getEntityManager ( ) -> getClassMetadata ( $ entity ) ; if ( \ in_array ( $ metadata -> getTypeOfField ( $ identifier ) , [ 'integer' , 'bigint' , 'smallint' ] ) ) { $ parameterType = Connection :: PARAM_INT_ARRAY ; // Filter out non-integer values (e.g. ""). If we don't, some // databases such as PostgreSQL fail. $ values = array_values ( array_filter ( $ values , function ( $ v ) { return ( string ) $ v === ( string ) ( int ) $ v ; } ) ) ; } elseif ( 'guid' === $ metadata -> getTypeOfField ( $ identifier ) ) { $ parameterType = Connection :: PARAM_STR_ARRAY ; $ type = Type :: getType ( Type :: GUID ) ; $ platform = $ qb -> getEntityManager ( ) -> getConnection ( ) -> getDatabasePlatform ( ) ; // Like above, but we just filter out empty strings and invalid guid. $ values = array_values ( array_filter ( $ values , function ( $ v ) use ( $ type , $ platform ) { $ guid = $ type -> convertToDatabaseValue ( $ v , $ platform ) ; return ! empty ( $ guid ) && '00000000-0000-0000-0000-000000000000' !== $ guid ; } ) ) ; } else { $ parameterType = Connection :: PARAM_STR_ARRAY ; } return [ $ parameterType , $ values ] ; }
Cleaned the values and get the parameter type.

@param QueryBuilder $qb         The query builder
@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 parameter type and the cleaned values
Cleaned the values and get the parameter type .