src/Database/DatabaseUtil.php
public function createWhereForSerializedBlob(string $field, array $values, string $connective = self::SQL_CONDITION_OR)
    {
        $where = null;
        $returnValues = [];

        if (!\in_array($connective, [self::SQL_CONDITION_OR, self::SQL_CONDITION_AND])) {
            throw new \Exception('Unknown sql junctor');
        }

        foreach ($values as $val) {
            if (null !== $where) {
                $where .= " $connective ";
            }

            $where .= self::SQL_CONDITION_AND == $connective ? '(' : '';

            $where .= "$field REGEXP (?)";

            $where .= self::SQL_CONDITION_AND == $connective ? ')' : '';

            $returnValues[] = "':\"$val\"'";
        }

        return ["($where)", $returnValues];
    }
public function createWhereForSerializedBlob(string $field, array $values, string $connective = self::SQL_CONDITION_OR)
    {
        $where = null;
        $returnValues = [];

        if (!\in_array($connective, [self::SQL_CONDITION_OR, self::SQL_CONDITION_AND])) {
            throw new \Exception('Unknown sql junctor');
        }

        foreach ($values as $val) {
            if (null !== $where) {
                $where .= " $connective ";
            }

            $where .= self::SQL_CONDITION_AND == $connective ? '(' : '';

            $where .= "$field REGEXP (?)";

            $where .= self::SQL_CONDITION_AND == $connective ? ')' : '';

            $returnValues[] = "':\"$val\"'";
        }

        return ["($where)", $returnValues];
    }
public function createWhereForSerializedBlob ( string $ field , array $ values , string $ connective = self :: SQL_CONDITION_OR ) { $ where = null ; $ returnValues = [ ] ; if ( ! \ in_array ( $ connective , [ self :: SQL_CONDITION_OR , self :: SQL_CONDITION_AND ] ) ) { throw new \ Exception ( 'Unknown sql junctor' ) ; } foreach ( $ values as $ val ) { if ( null !== $ where ) { $ where .= " $connective " ; } $ where .= self :: SQL_CONDITION_AND == $ connective ? '(' : '' ; $ where .= "$field REGEXP (?)" ; $ where .= self :: SQL_CONDITION_AND == $ connective ? ')' : '' ; $ returnValues [ ] = "':\"$val\"'" ; } return [ "($where)" , $ returnValues ] ; }
Create a where condition for a field that contains a serialized blob.

@param string $field      The field the condition should be checked against accordances
@param array  $values     The values array to check the field against
@param string $connective SQL_CONDITION_OR | SQL_CONDITION_AND

@return array
Create a where condition for a field that contains a serialized blob .