public function cast($value, $type)
    {
        if (is_string($type)) {
            $type = Type::build($type);
        }
        if ($type instanceof TypeInterface) {
            $value = $type->toDatabase($value, $this->_driver);
            $type = $type->toStatement($value, $this->_driver);
        }

        return [$value, $type];
    }
public function cast($value, $type)
    {
        if (is_string($type)) {
            $type = Type::build($type);
        }
        if ($type instanceof TypeInterface) {
            $value = $type->toDatabase($value, $this->_driver);
            $type = $type->toStatement($value, $this->_driver);
        }

        return [$value, $type];
    }
public function cast ( $ value , $ type ) { if ( is_string ( $ type ) ) { $ type = Type :: build ( $ type ) ; } if ( $ type instanceof TypeInterface ) { $ value = $ type -> toDatabase ( $ value , $ this -> _driver ) ; $ type = $ type -> toStatement ( $ value , $ this -> _driver ) ; } return [ $ value , $ type ] ; }
Converts a give value to a suitable database value based on type
and return relevant internal statement type

@param mixed $value The value to cast
@param \Cake\Database\Type|string $type The type name or type instance to use.
@return array list containing converted value and internal type
Converts a give value to a suitable database value based on type and return relevant internal statement type