diff --git a/lib/public/AppFramework/ORM/Repository.php b/lib/public/AppFramework/ORM/Repository.php index 00ca1989c90ae..7f3e26748b5c7 100644 --- a/lib/public/AppFramework/ORM/Repository.php +++ b/lib/public/AppFramework/ORM/Repository.php @@ -98,7 +98,7 @@ private function hydrateRow(string $entityClass, mixed $row): object { ColumnType::Bigint, ColumnType::Smallint, ColumnType::Integer => (int)$value, ColumnType::Float => (float)$value, ColumnType::Boolean => (bool)$value, - ColumnType::Binary, ColumnType::Decimal, ColumnType::Text, ColumnType::String => (string)$value, + ColumnType::Binary, ColumnType::Decimal, ColumnType::Guid, ColumnType::Text, ColumnType::String => (string)$value, ColumnType::Time, ColumnType::Date, ColumnType::Datetime, ColumnType::DatetimeTz => $value instanceof \DateTime ? $value : new \DateTime((string)$value), diff --git a/lib/public/DB/Schema/ColumnType.php b/lib/public/DB/Schema/ColumnType.php index 2a2cd1d633816..496157de59137 100644 --- a/lib/public/DB/Schema/ColumnType.php +++ b/lib/public/DB/Schema/ColumnType.php @@ -164,6 +164,15 @@ enum ColumnType: string { */ case Json = 'json'; + /** + * If you want to store a GUID, you should consider using this type, as some database vendors have a native data type for this kind of data which offers the most efficient way to store it. + * For vendors that do not support this type natively, this type is mapped to the string type internally. + * Values retrieved from the database are always converted to PHP's string type or null if no data is present. + * + * @since 35.0.0 + */ + case Guid = 'guid'; + /** * @since 35.0.0 */ diff --git a/lib/public/DB/Types.php b/lib/public/DB/Types.php index ad5525c3346f6..ac2ddf651884d 100644 --- a/lib/public/DB/Types.php +++ b/lib/public/DB/Types.php @@ -178,4 +178,13 @@ final class Types { * It is recommended to use a simple STRING field and handle JSON within PHP */ public const JSON = 'json'; + + /** + * If you want to store a GUID, you should consider using this type, as some database vendors have a native data type for this kind of data which offers the most efficient way to store it. + * For vendors that do not support this type natively, this type is mapped to the string type internally. + * Values retrieved from the database are always converted to PHP's string type or null if no data is present. + * + * @since 35.0.0 + */ + public const GUID = 'guid'; }