public static function serializeQueryValue($type, $value)
    {
        switch ($type) {
        case EdmType::DATETIME:
            $edmDate = Utilities::convertToEdmDateTime($value);
            return 'datetime\'' . $edmDate . '\'';

        case EdmType::BINARY:
            return 'X\'' . implode('', unpack("H*", $value)) . '\'';

        case EdmType::BOOLEAN:
            return ($value ? 'true' : 'false');

        case EdmType::DOUBLE:
        case EdmType::INT32:
            return $value;

        case EdmType::INT64:
            return $value . 'L';

        case EdmType::GUID:
            return 'guid\'' . $value . '\'';

        case null:
        case EdmType::STRING:
            // NULL also is treated as EdmType::STRING
            return '\'' . str_replace('\'', '\'\'', $value) . '\'';

        default:
            throw new \InvalidArgumentException();
        }
    }
public static function serializeQueryValue($type, $value)
    {
        switch ($type) {
        case EdmType::DATETIME:
            $edmDate = Utilities::convertToEdmDateTime($value);
            return 'datetime\'' . $edmDate . '\'';

        case EdmType::BINARY:
            return 'X\'' . implode('', unpack("H*", $value)) . '\'';

        case EdmType::BOOLEAN:
            return ($value ? 'true' : 'false');

        case EdmType::DOUBLE:
        case EdmType::INT32:
            return $value;

        case EdmType::INT64:
            return $value . 'L';

        case EdmType::GUID:
            return 'guid\'' . $value . '\'';

        case null:
        case EdmType::STRING:
            // NULL also is treated as EdmType::STRING
            return '\'' . str_replace('\'', '\'\'', $value) . '\'';

        default:
            throw new \InvalidArgumentException();
        }
    }
public static function serializeQueryValue ( $ type , $ value ) { switch ( $ type ) { case EdmType :: DATETIME : $ edmDate = Utilities :: convertToEdmDateTime ( $ value ) ; return 'datetime\'' . $ edmDate . '\'' ; case EdmType :: BINARY : return 'X\'' . implode ( '' , unpack ( "H*" , $ value ) ) . '\'' ; case EdmType :: BOOLEAN : return ( $ value ? 'true' : 'false' ) ; case EdmType :: DOUBLE : case EdmType :: INT32 : return $ value ; case EdmType :: INT64 : return $ value . 'L' ; case EdmType :: GUID : return 'guid\'' . $ value . '\'' ; case null : case EdmType :: STRING : // NULL also is treated as EdmType::STRING return '\'' . str_replace ( '\'' , '\'\'' , $ value ) . '\'' ; default : throw new \ InvalidArgumentException ( ) ; } }
Serializes EDM value into proper value to be used in query.

@param string $type  The EDM type.
@param mixed  $value The EDM value.

@internal

@return string

@throws \InvalidArgumentException
Serializes EDM value into proper value to be used in query .