lib/Doctrine/DBAL/Connection.php
private function _bindTypedValues($stmt, array $params, array $types)
    {
        // Check whether parameters are positional or named. Mixing is not allowed, just like in PDO.
        if (is_int(key($params))) {
            // Positional parameters
            $typeOffset = array_key_exists(0, $types) ? -1 : 0;
            $bindIndex  = 1;
            foreach ($params as $value) {
                $typeIndex = $bindIndex + $typeOffset;
                if (isset($types[$typeIndex])) {
                    $type                  = $types[$typeIndex];
                    [$value, $bindingType] = $this->getBindingInfo($value, $type);
                    $stmt->bindValue($bindIndex, $value, $bindingType);
                } else {
                    $stmt->bindValue($bindIndex, $value);
                }
                ++$bindIndex;
            }
        } else {
            // Named parameters
            foreach ($params as $name => $value) {
                if (isset($types[$name])) {
                    $type                  = $types[$name];
                    [$value, $bindingType] = $this->getBindingInfo($value, $type);
                    $stmt->bindValue($name, $value, $bindingType);
                } else {
                    $stmt->bindValue($name, $value);
                }
            }
        }
    }
private function _bindTypedValues($stmt, array $params, array $types)
    {
        // Check whether parameters are positional or named. Mixing is not allowed, just like in PDO.
        if (is_int(key($params))) {
            // Positional parameters
            $typeOffset = array_key_exists(0, $types) ? -1 : 0;
            $bindIndex  = 1;
            foreach ($params as $value) {
                $typeIndex = $bindIndex + $typeOffset;
                if (isset($types[$typeIndex])) {
                    $type                  = $types[$typeIndex];
                    [$value, $bindingType] = $this->getBindingInfo($value, $type);
                    $stmt->bindValue($bindIndex, $value, $bindingType);
                } else {
                    $stmt->bindValue($bindIndex, $value);
                }
                ++$bindIndex;
            }
        } else {
            // Named parameters
            foreach ($params as $name => $value) {
                if (isset($types[$name])) {
                    $type                  = $types[$name];
                    [$value, $bindingType] = $this->getBindingInfo($value, $type);
                    $stmt->bindValue($name, $value, $bindingType);
                } else {
                    $stmt->bindValue($name, $value);
                }
            }
        }
    }
private function _bindTypedValues ( $ stmt , array $ params , array $ types ) { // Check whether parameters are positional or named. Mixing is not allowed, just like in PDO. if ( is_int ( key ( $ params ) ) ) { // Positional parameters $ typeOffset = array_key_exists ( 0 , $ types ) ? - 1 : 0 ; $ bindIndex = 1 ; foreach ( $ params as $ value ) { $ typeIndex = $ bindIndex + $ typeOffset ; if ( isset ( $ types [ $ typeIndex ] ) ) { $ type = $ types [ $ typeIndex ] ; [ $ value , $ bindingType ] = $ this -> getBindingInfo ( $ value , $ type ) ; $ stmt -> bindValue ( $ bindIndex , $ value , $ bindingType ) ; } else { $ stmt -> bindValue ( $ bindIndex , $ value ) ; } ++ $ bindIndex ; } } else { // Named parameters foreach ( $ params as $ name => $ value ) { if ( isset ( $ types [ $ name ] ) ) { $ type = $ types [ $ name ] ; [ $ value , $ bindingType ] = $ this -> getBindingInfo ( $ value , $ type ) ; $ stmt -> bindValue ( $ name , $ value , $ bindingType ) ; } else { $ stmt -> bindValue ( $ name , $ value ) ; } } } }
Binds a set of parameters, some or all of which are typed with a PDO binding type
or DBAL mapping type, to a given statement.

@internal Duck-typing used on the $stmt parameter to support driver statements as well as
raw PDOStatement instances.

@param \Doctrine\DBAL\Driver\Statement $stmt   The statement to bind the values to.
@param mixed[]                         $params The map/list of named/positional parameters.
@param int[]|string[]                  $types  The parameter types (PDO binding types or DBAL mapping types).

@return void
Binds a set of parameters some or all of which are typed with a PDO binding type or DBAL mapping type to a given statement .